Block-Structured AMR Software Framework
 
Loading...
Searching...
No Matches
AMReX_FArrayBox.H
Go to the documentation of this file.
1
2#ifndef BL_FARRAYBOX_H
3#define BL_FARRAYBOX_H
4#include <AMReX_Config.H>
5
6#include <AMReX_BaseFab.H>
7#include <AMReX_FabConv.H>
8#include <AMReX_FabFactory.H>
9
10namespace amrex {
11
12class FArrayBox;
13
29class FABio // NOLINT(cppcoreguidelines-special-member-functions)
30{
31public:
40 {
43 };
66 enum Format
67 {
71 //
72 // This is set to four so that when reading in an old FAB,
73 // we don't get confused when we see an old FAB_8BITRLE file.
74 //
78 };
93
95 virtual ~FABio () = default;
101 virtual void read (std::istream& is,
102 FArrayBox& fb) const = 0;
110 virtual void write (std::ostream& os,
111 const FArrayBox& fb,
112 int comp,
113 int num_comp) const = 0;
120 virtual void skip (std::istream& is,
121 FArrayBox& f) const = 0;
122
123 virtual void skip (std::istream& is,
124 FArrayBox& f,
125 int nCompToSkip) const = 0;
130 virtual void write_header (std::ostream& os,
131 const FArrayBox& f,
132 int nvar) const;
144 static FABio* read_header (std::istream& is,
145 FArrayBox& f);
146
152 static FABio* read_header (std::istream& is,
153 FArrayBox& f,
154 int compIndex,
155 int& nCompAvailable);
156};
157
158//
159// Our binary FABio type.
160//
162 :
163 public FABio
164{
165public:
167
168 void read (std::istream& is,
169 FArrayBox& fb) const override;
170
171 void write (std::ostream& os,
172 const FArrayBox& fb,
173 int comp,
174 int num_comp) const override;
175
176 void skip (std::istream& is,
177 FArrayBox& f) const override;
178
179 void skip (std::istream& is,
180 FArrayBox& f,
181 int nCompToSkip) const override;
182
183private:
184 void write_header (std::ostream& os,
185 const FArrayBox& f,
186 int nvar) const override;
187
188 std::unique_ptr<RealDescriptor> realDesc;
189};
190
227 :
228 public BaseFab<Real>
229{
231 friend class FABio;
232public:
234 FArrayBox () noexcept = default;
235
236 explicit FArrayBox (Arena* ar) noexcept;
237
238 FArrayBox (const Box& b, int ncomp, Arena* ar);
239
245 explicit FArrayBox (const Box& b,
246 int ncomp=1,
247 bool alloc=true,
248 bool shared=false,
249 Arena* ar = nullptr);
250
251 FArrayBox (const FArrayBox& rhs, MakeType make_type, int scomp, int ncomp);
252
253 FArrayBox (const Box& b, int ncomp, Real const* p) noexcept;
254
255 FArrayBox (const Box& b, int ncomp, Real* p) noexcept;
256
257 explicit FArrayBox (Array4<Real> const& a) noexcept : BaseFab<Real>(a) {}
258
259 FArrayBox (Array4<Real> const& a, IndexType t) noexcept : BaseFab<Real>(a,t) {}
260
261 explicit FArrayBox (Array4<Real const> const& a) noexcept : BaseFab<Real>(a) {}
262
263 explicit FArrayBox (Array4<Real const> const& a, IndexType t) noexcept : BaseFab<Real>(a,t) {}
264
266 ~FArrayBox () noexcept override = default;
267
268 FArrayBox (FArrayBox&& rhs) noexcept = default;
269 FArrayBox& operator= (FArrayBox&&) noexcept = default;
270
271 FArrayBox (const FArrayBox&) = delete;
272 FArrayBox& operator= (const FArrayBox&) = delete;
273
275#if defined(AMREX_USE_GPU)
276 template <RunOn run_on>
277#else
278 template <RunOn run_on=RunOn::Host>
279#endif
280 FArrayBox& operator= (Real v) noexcept;
281
287#if defined(AMREX_USE_GPU)
288 template <RunOn run_on>
289#else
290 template <RunOn run_on=RunOn::Host>
291#endif
292 [[nodiscard]] bool contains_nan () const noexcept;
293
294#if defined(AMREX_USE_GPU)
295 template <RunOn run_on>
296#else
297 template <RunOn run_on=RunOn::Host>
298#endif
299 [[nodiscard]] bool contains_nan (const Box& bx, int scomp, int ncomp) const noexcept;
304#if defined(AMREX_USE_GPU)
305 template <RunOn run_on>
306#else
307 template <RunOn run_on=RunOn::Host>
308#endif
309 bool contains_nan (IntVect& where) const noexcept;
310
311#if defined(AMREX_USE_GPU)
312 template <RunOn run_on>
313#else
314 template <RunOn run_on=RunOn::Host>
315#endif
316 bool contains_nan (const Box& bx, int scomp, int ncomp, IntVect& where) const noexcept;
322#if defined(AMREX_USE_GPU)
323 template <RunOn run_on>
324#else
325 template <RunOn run_on=RunOn::Host>
326#endif
327 [[nodiscard]] bool contains_inf () const noexcept;
328
329#if defined(AMREX_USE_GPU)
330 template <RunOn run_on>
331#else
332 template <RunOn run_on=RunOn::Host>
333#endif
334 [[nodiscard]] bool contains_inf (const Box& bx, int scomp, int ncomp) const noexcept;
339#if defined(AMREX_USE_GPU)
340 template <RunOn run_on>
341#else
342 template <RunOn run_on=RunOn::Host>
343#endif
344 bool contains_inf (IntVect& where) const noexcept;
345
346#if defined(AMREX_USE_GPU)
347 template <RunOn run_on>
348#else
349 template <RunOn run_on=RunOn::Host>
350#endif
351 bool contains_inf (const Box& bx, int scomp, int ncomp, IntVect& where) const noexcept;
352
354 void resize (const Box& b, int N = 1, Arena* ar = nullptr);
355
356 [[nodiscard]] FabType getType () const noexcept { return m_type; }
357
358 void initVal () noexcept; // public for cuda
359
361 friend std::ostream& operator<< (std::ostream& os, const FArrayBox& fb);
363 friend std::istream& operator>> (std::istream& is, FArrayBox& fb);
368 void writeOn (std::ostream& os) const;
369
381 void writeOn (std::ostream& os,
382 int comp,
383 int num_comp=1) const;
384
386 void readFrom (std::istream& is);
387
394 int readFrom (std::istream& is, int compIndex);
395
401 static Box skipFAB (std::istream& is,
402 int& num_comp);
403
405 static void skipFAB (std::istream& is);
406
414 static void setFormat (FABio::Format fmt);
415
417 static FABio::Format getFormat ();
418
430 static void setOrdering (FABio::Ordering ordering);
431
437 static FABio::Ordering getOrdering ();
438
443 static void setPrecision (FABio::Precision precision);
444
450 static FABio::Precision getPrecision ();
451
453 static const FABio& getFABio ();
454
459 static void setFABio (FABio* rd);
460
461 static std::unique_ptr<RealDescriptor> getDataDescriptor ();
462
463 static std::string getClassName ();
464
465 static bool set_do_initval (bool tf);
466 static bool get_do_initval ();
467 static Real set_initval (Real iv);
468 static Real get_initval ();
470 static void Initialize ();
471 static void Finalize ();
472 static bool initialized;
473
474protected:
475
477
482 static FABio::Format format;
483 static FABio::Ordering ordering;
484
486 static FABio* fabio;
487
489 static bool do_initval;
490 static Real initval;
491 static bool init_snan;
492};
493
495
496template <RunOn run_on>
498FArrayBox::operator= (Real v) noexcept
499{
500 BaseFab<Real>::operator=<run_on>(v);
501 return *this;
502}
503
504template <RunOn run_on>
505bool
506FArrayBox::contains_nan () const noexcept
507{
508 const Real* dp = dptr;
509 const Long n = numPts()*nvar;
510#ifdef AMREX_USE_GPU
511 if (run_on == RunOn::Device && Gpu::inLaunchRegion()) {
513 ReduceData<int> reduce_data(reduce_op);
514 using ReduceTuple = ReduceData<int>::Type;
515 reduce_op.eval(n, reduce_data,
516 [=] AMREX_GPU_DEVICE (Long i) -> ReduceTuple
517 {
518 return { static_cast<int>(amrex::isnan(dp[i])) };
519 });
520 ReduceTuple hv = reduce_data.value(reduce_op);
521 return amrex::get<0>(hv);
522 } else
523#endif
524 {
525 for (Long i = 0; i < n; i++) {
526 if (amrex::isnan(*dp++)) {
527 return true;
528 }
529 }
530 return false;
531 }
532}
533
534template <RunOn run_on>
535bool
536FArrayBox::contains_nan (const Box& bx, int scomp, int ncomp) const noexcept
537{
538 BL_ASSERT(scomp >= 0);
539 BL_ASSERT(ncomp >= 1);
540 BL_ASSERT(scomp < nComp());
541 BL_ASSERT(ncomp <= nComp());
543
544 const auto& a = this->array();
545
546#ifdef AMREX_USE_GPU
547 if (run_on == RunOn::Device && Gpu::inLaunchRegion()) {
549 ReduceData<int> reduce_data(reduce_op);
550 using ReduceTuple = ReduceData<int>::Type;
551 reduce_op.eval(bx, reduce_data,
552 [=] AMREX_GPU_DEVICE (int i, int j, int k) -> ReduceTuple
553 {
554 bool t = false;
555 for (int n = scomp; n < scomp+ncomp; ++n) {
556 t = t || amrex::isnan(a(i,j,k,n));
557 }
558 return { static_cast<int>(t) };
559 });
560 ReduceTuple hv = reduce_data.value(reduce_op);
561 return amrex::get<0>(hv);
562 } else
563#endif
564 {
565 const auto lo = amrex::lbound(bx);
566 const auto hi = amrex::ubound(bx);
567 for (int n = scomp; n < scomp+ncomp; ++n) {
568 for (int k = lo.z; k <= hi.z; ++k) {
569 for (int j = lo.y; j <= hi.y; ++j) {
570 for (int i = lo.x; i <= hi.x; ++i) {
571 if (amrex::isnan(a(i,j,k,n))) {
572 return true;
573 }
574 }
575 }
576 }
577 }
578 return false;
579 }
580}
581
582template <RunOn run_on>
583bool
584FArrayBox::contains_nan (IntVect& where) const noexcept
585{
586 return contains_nan<run_on>(domain, 0, nComp(), where);
587}
588
589template <RunOn run_on>
590bool
591FArrayBox::contains_nan (const Box& bx, int scomp, int ncomp, IntVect& where) const noexcept
592{
593 BL_ASSERT(scomp >= 0);
594 BL_ASSERT(ncomp >= 1);
595 BL_ASSERT(scomp < nComp());
596 BL_ASSERT(ncomp <= nComp());
598
599 const auto& a = this->array();
600#ifdef AMREX_USE_GPU
601 if (run_on == RunOn::Device && Gpu::inLaunchRegion()) {
602 Array<int,1+AMREX_SPACEDIM> ha{0,AMREX_D_DECL(std::numeric_limits<int>::lowest(),
603 std::numeric_limits<int>::lowest(),
604 std::numeric_limits<int>::lowest())};
605 Gpu::DeviceVector<int> dv(1+AMREX_SPACEDIM);
606 int* p = dv.data();
607 Gpu::htod_memcpy_async(p, ha.data(), sizeof(int)*ha.size());
608 amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
609 {
610 int* flag = p;
611 bool t = false;
612 for (int n = scomp; n < scomp+ncomp; ++n) {
613 t = t || amrex::isnan(a(i,j,k,n));
614 }
615 if (t && (*flag == 0)) {
616 if (Gpu::Atomic::Exch(flag,1) == 0) {
617 AMREX_D_TERM(p[1] = i;,
618 p[2] = j;,
619 p[3] = k;);
620 }
621 }
622 });
623 Gpu::dtoh_memcpy_async(ha.data(), p, sizeof(int)*ha.size());
625 where = IntVect(AMREX_D_DECL(ha[1],ha[2],ha[3]));
626 return ha[0];
627 } else
628#endif
629 {
630 const auto lo = amrex::lbound(bx);
631 const auto hi = amrex::ubound(bx);
632 for (int n = scomp; n < scomp+ncomp; ++n) {
633 for (int k = lo.z; k <= hi.z; ++k) {
634 for (int j = lo.y; j <= hi.y; ++j) {
635 for (int i = lo.x; i <= hi.x; ++i) {
636 if (amrex::isnan(a(i,j,k,n))) {
637 where = IntVect(AMREX_D_DECL(i,j,k));
638 return true;
639 }
640 }
641 }
642 }
643 }
644 return false;
645 }
646}
647
648template <RunOn run_on>
649bool
650FArrayBox::contains_inf () const noexcept
651{
652 const Real* dp = dptr;
653 const Long n = numPts()*nvar;
654#ifdef AMREX_USE_GPU
655 if (run_on == RunOn::Device && Gpu::inLaunchRegion()) {
657 ReduceData<int> reduce_data(reduce_op);
658 using ReduceTuple = ReduceData<int>::Type;
659 reduce_op.eval(n, reduce_data,
660 [=] AMREX_GPU_DEVICE (Long i) -> ReduceTuple
661 {
662 return { static_cast<int>(amrex::isinf(dp[i])) };
663 });
664 ReduceTuple hv = reduce_data.value(reduce_op);
665 return amrex::get<0>(hv);
666 } else
667#endif
668 {
669 for (Long i = 0; i < n; i++) {
670 if (amrex::isinf(*dp++)) {
671 return true;
672 }
673 }
674 return false;
675 }
676}
677
678template <RunOn run_on>
679bool
680FArrayBox::contains_inf (const Box& bx, int scomp, int ncomp) const noexcept
681{
682 BL_ASSERT(scomp >= 0);
683 BL_ASSERT(ncomp >= 1);
684 BL_ASSERT(scomp < nComp());
685 BL_ASSERT(ncomp <= nComp());
687
688 const auto& a = this->array();
689
690#ifdef AMREX_USE_GPU
691 if (run_on == RunOn::Device && Gpu::inLaunchRegion()) {
693 ReduceData<int> reduce_data(reduce_op);
694 using ReduceTuple = ReduceData<int>::Type;
695 reduce_op.eval(bx, reduce_data,
696 [=] AMREX_GPU_DEVICE (int i, int j, int k) ->ReduceTuple
697 {
698 bool t = false;
699 for (int n = scomp; n < scomp+ncomp; ++n) {
700 t = t || amrex::isinf(a(i,j,k,n));
701 }
702 return { static_cast<int>(t) };
703 });
704 ReduceTuple hv = reduce_data.value(reduce_op);
705 return amrex::get<0>(hv);
706 } else
707#endif
708 {
709 const auto lo = amrex::lbound(bx);
710 const auto hi = amrex::ubound(bx);
711 for (int n = scomp; n < scomp+ncomp; ++n) {
712 for (int k = lo.z; k <= hi.z; ++k) {
713 for (int j = lo.y; j <= hi.y; ++j) {
714 for (int i = lo.x; i <= hi.x; ++i) {
715 if (amrex::isinf(a(i,j,k,n))) {
716 return true;
717 }
718 }
719 }
720 }
721 }
722 return false;
723 }
724}
725
726template <RunOn run_on>
727bool
728FArrayBox::contains_inf (IntVect& where) const noexcept
729{
730 return contains_inf<run_on>(domain,0,nComp(),where);
731}
732
733template <RunOn run_on>
734bool
735FArrayBox::contains_inf (const Box& bx, int scomp, int ncomp, IntVect& where) const noexcept
736{
737 BL_ASSERT(scomp >= 0);
738 BL_ASSERT(ncomp >= 1);
739 BL_ASSERT(scomp < nComp());
740 BL_ASSERT(ncomp <= nComp());
742
743 const auto& a = this->array();
744#ifdef AMREX_USE_GPU
745 if (run_on == RunOn::Device && Gpu::inLaunchRegion()) {
746 Array<int,1+AMREX_SPACEDIM> ha{0,AMREX_D_DECL(std::numeric_limits<int>::lowest(),
747 std::numeric_limits<int>::lowest(),
748 std::numeric_limits<int>::lowest())};
749 Gpu::DeviceVector<int> dv(1+AMREX_SPACEDIM);
750 int* p = dv.data();
751 Gpu::htod_memcpy_async(p, ha.data(), sizeof(int)*ha.size());
752 amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
753 {
754 int* flag = p;
755 bool t = false;
756 for (int n = scomp; n < scomp+ncomp; ++n) {
757 t = t || amrex::isinf(a(i,j,k,n));
758 }
759 if (t && (*flag == 0)) {
760 if (Gpu::Atomic::Exch(flag,1) == 0) {
761 AMREX_D_TERM(p[1] = i;,
762 p[2] = j;,
763 p[3] = k;);
764 }
765 }
766 });
767 Gpu::dtoh_memcpy_async(ha.data(), p, sizeof(int)*ha.size());
769 where = IntVect(AMREX_D_DECL(ha[1],ha[2],ha[3]));
770 return ha[0];
771 } else
772#endif
773 {
774 const auto lo = amrex::lbound(bx);
775 const auto hi = amrex::ubound(bx);
776 for (int n = scomp; n < scomp+ncomp; ++n) {
777 for (int k = lo.z; k <= hi.z; ++k) {
778 for (int j = lo.y; j <= hi.y; ++j) {
779 for (int i = lo.x; i <= hi.x; ++i) {
780 if (amrex::isinf(a(i,j,k,n))) {
781 where = IntVect(AMREX_D_DECL(i,j,k));
782 return true;
783 }
784 }
785 }
786 }
787 }
788 return false;
789 }
790}
791
792}
793
794#endif /*BL_FARRAYBOX_H*/
#define BL_ASSERT(EX)
Definition AMReX_BLassert.H:39
#define AMREX_GPU_DEVICE
Definition AMReX_GpuQualifiers.H:18
#define AMREX_D_TERM(a, b, c)
Definition AMReX_SPACE.H:129
A virtual base class for objects that manage their own dynamic memory allocation.
Definition AMReX_Arena.H:100
A FortranArrayBox(FAB)-like object.
Definition AMReX_BaseFab.H:183
Box domain
My index space.
Definition AMReX_BaseFab.H:1650
Real * dptr
The data pointer.
Definition AMReX_BaseFab.H:1649
int nvar
Number components.
Definition AMReX_BaseFab.H:1651
AMREX_FORCE_INLINE Array4< Real const > array() const noexcept
Definition AMReX_BaseFab.H:379
Long numPts() const noexcept
Returns the number of points.
Definition AMReX_BaseFab.H:285
int nComp() const noexcept
Returns the number of components.
Definition AMReX_BaseFab.H:277
AMREX_GPU_HOST_DEVICE bool contains(const IntVectND< dim > &p) const noexcept
Returns true if argument is contained within BoxND.
Definition AMReX_Box.H:204
Definition AMReX_FabFactory.H:76
Definition AMReX_FArrayBox.H:164
std::unique_ptr< RealDescriptor > realDesc
Definition AMReX_FArrayBox.H:188
void read(std::istream &is, FArrayBox &fb) const override
Pure virtual function. Derived classes MUST override this function to read an FArrayBox from the istr...
Definition AMReX_FArrayBox.cpp:915
void write_header(std::ostream &os, const FArrayBox &f, int nvar) const override
Write out a header describing FArrayBox f that contains nvar components. It must be the case that nva...
Definition AMReX_FArrayBox.cpp:905
void skip(std::istream &is, FArrayBox &f) const override
Pure virtual function. Derived classes MUST override this function to skip over the next FAB f in the...
Definition AMReX_FArrayBox.cpp:949
void write(std::ostream &os, const FArrayBox &fb, int comp, int num_comp) const override
Pure virtual function. Derived classes MUST override this function to write the FArrayBox to the ostr...
Definition AMReX_FArrayBox.cpp:929
A Class Facilitating I/O for Fabs.
Definition AMReX_FArrayBox.H:30
Format
An enum which controls format of FAB output.
Definition AMReX_FArrayBox.H:67
@ FAB_IEEE
Definition AMReX_FArrayBox.H:69
@ FAB_NATIVE_32
Definition AMReX_FArrayBox.H:77
@ FAB_ASCII
Definition AMReX_FArrayBox.H:68
@ FAB_NATIVE
Definition AMReX_FArrayBox.H:70
@ FAB_8BIT
Definition AMReX_FArrayBox.H:75
@ FAB_IEEE_32
Definition AMReX_FArrayBox.H:76
virtual void skip(std::istream &is, FArrayBox &f) const =0
Pure virtual function. Derived classes MUST override this function to skip over the next FAB f in the...
Precision
An enum which controls precision of FAB output. Valid values are FAB_FLOAT and FAB_DOUBLE....
Definition AMReX_FArrayBox.H:40
@ FAB_DOUBLE
Definition AMReX_FArrayBox.H:42
@ FAB_FLOAT
Definition AMReX_FArrayBox.H:41
virtual void read(std::istream &is, FArrayBox &fb) const =0
Pure virtual function. Derived classes MUST override this function to read an FArrayBox from the istr...
virtual void skip(std::istream &is, FArrayBox &f, int nCompToSkip) const =0
static FABio * read_header(std::istream &is, FArrayBox &f)
Read in the header from the istream. Returns a new'd FABio of the written-out type....
Definition AMReX_FArrayBox.cpp:448
virtual void write(std::ostream &os, const FArrayBox &fb, int comp, int num_comp) const =0
Pure virtual function. Derived classes MUST override this function to write the FArrayBox to the ostr...
Ordering
An enum which controls byte ordering of FAB output. Valid values are FAB_NORMAL_ORDER,...
Definition AMReX_FArrayBox.H:88
@ FAB_REVERSE_ORDER
Definition AMReX_FArrayBox.H:90
@ FAB_NORMAL_ORDER
Definition AMReX_FArrayBox.H:89
@ FAB_REVERSE_ORDER_2
Definition AMReX_FArrayBox.H:91
virtual ~FABio()=default
The virtual destructor.
virtual void write_header(std::ostream &os, const FArrayBox &f, int nvar) const
Write out a header describing FArrayBox f that contains nvar components. It must be the case that nva...
Definition AMReX_FArrayBox.cpp:95
A Fortran Array of REALs.
Definition AMReX_FArrayBox.H:229
void initVal() noexcept
Definition AMReX_FArrayBox.cpp:143
static void Finalize()
Definition AMReX_FArrayBox.cpp:431
static std::string getClassName()
Definition AMReX_FArrayBox.cpp:222
static bool initialized
Definition AMReX_FArrayBox.H:472
static Box skipFAB(std::istream &is, int &num_comp)
Skip over the next FAB from the input stream. Return the Box defining the domain of the FAB and the n...
Definition AMReX_FArrayBox.cpp:673
static void Initialize()
Initialize from ParmParse with "fab" prefix.
Definition AMReX_FArrayBox.cpp:333
static FABio::Precision getPrecision()
Returns the FABio::Precision. This is deprecated. It is not useful with the "new" FAB I/O format....
Definition AMReX_FArrayBox.cpp:298
FabType getType() const noexcept
Definition AMReX_FArrayBox.H:356
static void setOrdering(FABio::Ordering ordering)
Set the FABio::Ordering for reading old FABs. It does NOT set the ordering for output....
Definition AMReX_FArrayBox.cpp:278
void writeOn(std::ostream &os) const
Writes out the FAB in whatever format you've set. The default format is NATIVE.
Definition AMReX_FArrayBox.cpp:228
FArrayBox(Array4< Real const > const &a) noexcept
Definition AMReX_FArrayBox.H:261
static Real initval
Definition AMReX_FArrayBox.H:490
static const FABio & getFABio()
Returns reference to the FABio object used by the program.
Definition AMReX_FArrayBox.cpp:191
static void setFormat(FABio::Format fmt)
Set the FABio::Format in the program. This is the preferred way to set the output format in "new" FAB...
Definition AMReX_FArrayBox.cpp:241
static void setPrecision(FABio::Precision precision)
Set the FABio::Precision. This is deprecated. It is not useful with the "new" FAB I/O format.
Definition AMReX_FArrayBox.cpp:292
static void setFABio(FABio *rd)
Sets the FABio object used by the program. It is an error if the passed pointer rd is the null pointe...
Definition AMReX_FArrayBox.cpp:197
static FABio * fabio
The FABio pointer describing our output format.
Definition AMReX_FArrayBox.H:486
FabType m_type
Definition AMReX_FArrayBox.H:476
void readFrom(std::istream &is)
Read FAB from istream. Format is as it was written out.
Definition AMReX_FArrayBox.cpp:625
static FABio::Format format
Format and ordering for all FAB output. This stuff exists solely to support reading old FABs.
Definition AMReX_FArrayBox.H:482
FArrayBox & operator=(FArrayBox &&) noexcept=default
FArrayBox(Array4< Real const > const &a, IndexType t) noexcept
Definition AMReX_FArrayBox.H:263
FArrayBox(Array4< Real > const &a, IndexType t) noexcept
Definition AMReX_FArrayBox.H:259
static FABio::Ordering ordering
Definition AMReX_FArrayBox.H:483
static std::unique_ptr< RealDescriptor > getDataDescriptor()
Definition AMReX_FArrayBox.cpp:205
static FABio::Ordering getOrdering()
Gets the FABio::Ordering set in the program. This is deprecated. It does NOT do the right thing with ...
Definition AMReX_FArrayBox.cpp:285
static Real get_initval()
Definition AMReX_FArrayBox.cpp:327
static bool do_initval
initial value
Definition AMReX_FArrayBox.H:489
bool contains_nan() const noexcept
Are there any NaNs in the FAB? This may return false, even if the FAB contains NaNs,...
Definition AMReX_FArrayBox.H:506
FArrayBox() noexcept=default
Construct an invalid FAB with no memory.
static FABio::Format getFormat()
Gets the FABio::Format set in the program.
Definition AMReX_FArrayBox.cpp:185
static Real set_initval(Real iv)
Definition AMReX_FArrayBox.cpp:319
static bool set_do_initval(bool tf)
Definition AMReX_FArrayBox.cpp:305
void resize(const Box &b, int N=1, Arena *ar=nullptr)
For debugging purposes we hide BaseFab version and do some extra work.
Definition AMReX_FArrayBox.cpp:178
static bool get_do_initval()
Definition AMReX_FArrayBox.cpp:313
static bool init_snan
Definition AMReX_FArrayBox.H:491
~FArrayBox() noexcept override=default
The destructor.
bool contains_inf() const noexcept
Are there any Infs in the FAB? This may return false, even if the FAB contains Infs,...
Definition AMReX_FArrayBox.H:650
Definition AMReX_Tuple.H:93
Definition AMReX_PODVector.H:262
T * data() noexcept
Definition AMReX_PODVector.H:609
A Descriptor of the Real Type.
Definition AMReX_FabConv.H:105
Definition AMReX_Reduce.H:249
Type value()
Definition AMReX_Reduce.H:281
Definition AMReX_Reduce.H:364
std::enable_if_t< IsFabArray< MF >::value > eval(MF const &mf, IntVect const &nghost, D &reduce_data, F &&f)
Definition AMReX_Reduce.H:441
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T Exch(T *address, T val) noexcept
Definition AMReX_GpuAtomic.H:485
void streamSynchronize() noexcept
Definition AMReX_GpuDevice.H:237
void dtoh_memcpy_async(void *p_h, const void *p_d, const std::size_t sz) noexcept
Definition AMReX_GpuDevice.H:265
bool inLaunchRegion() noexcept
Definition AMReX_GpuControl.H:86
void htod_memcpy_async(void *p_d, const void *p_h, const std::size_t sz) noexcept
Definition AMReX_GpuDevice.H:251
Definition AMReX_Amr.cpp:49
MakeType
Definition AMReX_MakeType.H:7
std::enable_if_t< std::is_integral_v< T > > ParallelFor(TypeList< CTOs... > ctos, std::array< int, sizeof...(CTOs)> const &runtime_options, T N, F &&f)
Definition AMReX_CTOParallelForImpl.H:191
RunOn
Definition AMReX_GpuControl.H:69
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 ubound(Array4< T > const &a) noexcept
Definition AMReX_Array4.H:315
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 lbound(Array4< T > const &a) noexcept
Definition AMReX_Array4.H:308
IntVectND< AMREX_SPACEDIM > IntVect
Definition AMReX_BaseFwd.H:30
FabType
Definition AMReX_FabFactory.H:18
std::array< T, N > Array
Definition AMReX_Array.H:24
Definition AMReX_Array4.H:61
void * alloc(std::size_t sz) const noexcept
Definition AMReX_DataAllocator.H:16