Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
AMReX_RealVect.H
Go to the documentation of this file.
1#ifndef AMREX_REALVECT_H_
2#define AMREX_REALVECT_H_
3#include <AMReX_Config.H>
4
5#include <AMReX_Box.H>
6#include <AMReX_REAL.H>
7#include <AMReX_SPACE.H>
8#include <AMReX_IntVect.H>
9#include <AMReX_Utility.H>
10#include <AMReX_Math.H>
11
12#include <cmath>
13#include <cstddef>
14#include <cstdlib>
15#include <cstring>
16#include <iosfwd>
17#include <vector>
18
19namespace amrex
20{
21
33template <int dim>
35 public:
40
42
45 constexpr RealVectND () noexcept {} // NOLINT
46
47 explicit RealVectND (const std::vector<Real>& vr) noexcept {
48 BL_ASSERT(vr.size() == dim);
49 for (int i = 0; i < dim; ++i) {
50 vect[i] = vr[i];
51 }
52 }
53
55
59 template <class... Args>
60 requires ((sizeof...(Args) + 2 == dim) &&
61 IsConvertible_v<Real, Args...>)
63 constexpr RealVectND (Real i, Real j, Args... ks) noexcept
64 : vect{i, j, static_cast<Real>(ks)...} {}
65
67 explicit constexpr RealVectND (Real s) noexcept {
68 for (int i = 0; i < dim; ++i) {
69 vect[i] = s;
70 }
71 }
72
74
79 explicit RealVectND (const Real* a) noexcept {
80 for (int i = 0; i < dim; ++i) {
81 vect[i] = a[i];
82 }
83 }
84
86
90 AMREX_GPU_HOST_DEVICE constexpr
91 RealVectND (const IntVectND<dim>& iv) noexcept {
92 for (int i = 0; i < dim; ++i) {
93 vect[i] = static_cast<Real>(iv[i]);
94 }
95 }
96
98
101 AMREX_GPU_HOST_DEVICE constexpr
102 RealVectND (const GpuArray<Real, dim> ga) noexcept {
103 for (int i = 0; i < dim; ++i) {
104 vect[i] = ga[i];
105 }
106 }
107
109
113 Real& operator[] (int i) && = delete;
114
116
120 AMREX_GPU_HOST_DEVICE constexpr
121 Real& operator[] (int i) & noexcept {
122 AMREX_ASSERT(i >= 0 && i < dim);
123 return vect[i];
124 }
125
127
130 AMREX_GPU_HOST_DEVICE constexpr
131 const Real& operator[] (int i) const& noexcept {
132 AMREX_ASSERT(i >= 0 && i < dim);
133 return vect[i];
134 }
135
137 template<std::size_t i>
138 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr
139 Real& get () noexcept {static_assert(0<=i && i<dim); return vect[i];}
140
142 template<std::size_t i>
143 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr
144 const Real& get () const noexcept {static_assert(0<=i && i<dim); return vect[i];}
145
146 [[nodiscard]] AMREX_GPU_HOST_DEVICE constexpr
147 GpuArray<Real, dim> to_array () const noexcept {
148 GpuArray<Real, dim> retval{};
149 for (int i = 0; i < dim; ++i) {
150 retval[i] = vect[i];
151 }
152 return retval;
153 }
154
161
163
166 [[nodiscard]] AMREX_GPU_HOST_DEVICE constexpr
167 Real* begin () noexcept { return vect; }
168
170
173 [[nodiscard]] AMREX_GPU_HOST_DEVICE constexpr
174 const Real* begin () const noexcept { return vect; }
175
177
180 [[nodiscard]] AMREX_GPU_HOST_DEVICE constexpr
181 Real* end () noexcept { return vect + dim; }
182
184
187 [[nodiscard]] AMREX_GPU_HOST_DEVICE constexpr
188 const Real* end () const noexcept {
189 return vect + dim;
190 }
191
198
200
204 AMREX_GPU_HOST_DEVICE constexpr
205 bool operator== (const RealVectND& p) const noexcept {
206 bool retval = vect[0] == p[0];
207 for (int i=1; i<dim; ++i) {
208 retval = retval && vect[i] == p[i];
209 }
210 return retval;
211 }
212
214
218 AMREX_GPU_HOST_DEVICE constexpr
219 bool operator!= (const RealVectND& p) const noexcept {
220 bool retval = vect[0] != p[0];
221 for (int i=1; i<dim; ++i) {
222 retval = retval || vect[i] != p[i];
223 }
224 return retval;
225 }
226
228
235 AMREX_GPU_HOST_DEVICE inline bool operator< (const RealVectND& p) const noexcept;
236
238
245 AMREX_GPU_HOST_DEVICE inline bool operator<= (const RealVectND& p) const noexcept;
246
248
255 AMREX_GPU_HOST_DEVICE inline bool operator> (const RealVectND& p) const noexcept;
256
258
266 AMREX_GPU_HOST_DEVICE inline bool operator>= (const RealVectND& p) const noexcept;
267
274
276
280
282
287
289
293
295
300
302
306
308
313
315
319
321
324 [[nodiscard]] AMREX_GPU_HOST_DEVICE inline Real dotProduct (
325 const RealVectND& a_rhs) const noexcept;
326
328
332 const RealVectND& a_rhs) const noexcept requires (dim == 3);
333
334
336
340
342
347
349
353
355
359
361
366
368
372
374
378 [[nodiscard]] AMREX_GPU_HOST_DEVICE inline IntVectND<dim> floor () const noexcept;
379
381
385 [[nodiscard]] AMREX_GPU_HOST_DEVICE inline IntVectND<dim> ceil () const noexcept;
386
388
392 [[nodiscard]] AMREX_GPU_HOST_DEVICE inline IntVectND<dim> round () const noexcept;
393
400
402
406 AMREX_GPU_HOST_DEVICE inline RealVectND& min (const RealVectND& p) noexcept;
407
409
413 AMREX_GPU_HOST_DEVICE inline RealVectND& max (const RealVectND& p) noexcept;
414
421
423
426 AMREX_GPU_HOST_DEVICE inline RealVectND operator+ () const noexcept;
427
429
432 AMREX_GPU_HOST_DEVICE inline RealVectND operator- () const noexcept;
433
435
438 [[nodiscard]] AMREX_GPU_HOST_DEVICE inline Real sum () const noexcept;
439
441
444 [[nodiscard]] AMREX_GPU_HOST_DEVICE inline Real vectorLength () const noexcept;
445
447
450 [[nodiscard]] AMREX_GPU_HOST_DEVICE inline Real radSquared () const noexcept;
451
453
456 [[nodiscard]] AMREX_GPU_HOST_DEVICE inline Real product () const noexcept;
457
459
463 [[nodiscard]] AMREX_GPU_HOST_DEVICE inline int minDir (const bool& a_doAbs) const noexcept;
464
466
470 [[nodiscard]] AMREX_GPU_HOST_DEVICE inline int maxDir (const bool& a_doAbs) const noexcept;
471
478
480
483 [[nodiscard]] AMREX_GPU_HOST_DEVICE const Real* dataPtr () const noexcept { return vect; }
484
486
490 Real* dataPtr () noexcept { return vect; }
491
498
500
503 static const RealVectND Zero;
504
506
509 static const RealVectND Unit;
510
517
519
523 return RealVectND{0.};
524 }
525
530 return RealVectND{1.};
531 }
532
536 static constexpr std::size_t size () noexcept {
537 return static_cast<std::size_t>(dim);
538 }
539
541 static constexpr int isize () noexcept {
542 return dim;
543 }
544
546
551 template<int new_dim>
553 RealVectND<new_dim> shrink () const noexcept {
554 static_assert(new_dim <= dim);
555 return RealVectND<new_dim>(this->begin());
556 }
557
562 template<int new_dim>
564 RealVectND<new_dim> expand (Real fill_extra=0.) const noexcept {
565 static_assert(new_dim >= dim);
566 RealVectND<new_dim> retval(fill_extra);
567 for (int i=0; i<dim; ++i) {
568 retval[i] = vect[i];
569 }
570 return retval;
571 }
572
577 template<int new_dim>
579 RealVectND<new_dim> resize (Real fill_extra=0.) const noexcept {
580 if constexpr (new_dim > dim) {
581 return expand<new_dim>(fill_extra);
582 } else {
583 return shrink<new_dim>();
584 }
585 }
586
587protected:
591 Real vect[dim] = {};
592};
593
594// Template deduction guide for RealVectND
595template <class... Args>
596requires (IsConvertible_v<Real, Args...>)
597#if defined(__clang__) && __clang_major__ < 22
598AMREX_GPU_HOST_DEVICE // __device__ for HIP
599#endif
600RealVectND(Real, Real, Args...) -> RealVectND<sizeof...(Args)+2>;
601
602// Template deduction guide for RealVectND
603template<int dim>
604#if defined(__clang__) && __clang_major__ < 22
605AMREX_GPU_HOST_DEVICE // __device__ for HIP
606#endif
608
609// Template deduction guide for RealVectND
610template<int dim>
611#if defined(__clang__) && __clang_major__ < 22
612AMREX_GPU_HOST_DEVICE // __device__ for HIP
613#endif
615
616template <int dim>
617inline constexpr const RealVectND<dim> RealVectND<dim>::Zero{Real(0)};
618
619template <int dim>
620inline constexpr const RealVectND<dim> RealVectND<dim>::Unit{Real(1)};
621
622using RealVect = RealVectND<AMREX_SPACEDIM>;
623
624template <int dim>
626RealVectND<dim>&
628 for (int i=0; i<dim; ++i) {
629 vect[i] -= s;
630 }
631 return *this;
632}
633
634template <int dim>
638 for (int i=0; i<dim; ++i) {
639 vect[i] *= s;
640 }
641 return *this;
642}
643
644template <int dim>
648 for (int i=0; i<dim; ++i) {
649 vect[i] -= p[i];
650 }
651 return *this;
652}
653
654template <int dim>
658 return RealVectND<dim>(*this);
659}
660
661template <int dim>
665 RealVectND<dim> retval;
666 for (int i=0; i<dim; ++i) {
667 retval[i] = -vect[i];
668 }
669 return retval;
670}
671
672template <int dim>
676 for (int i=0; i<dim; ++i) {
677 vect[i] *= s;
678 }
679 return *this;
680}
681
682template <int dim>
685RealVectND<dim>::floor () const noexcept {
686 IntVectND<dim> retval;
687 for (int i=0; i<dim; ++i) {
688 retval[i] = static_cast<int>(std::floor(vect[i]));
689 }
690 return retval;
691}
692
693template <int dim>
696RealVectND<dim>::ceil () const noexcept {
697 IntVectND<dim> retval;
698 for (int i=0; i<dim; ++i) {
699 retval[i] = static_cast<int>(std::ceil(vect[i]));
700 }
701 return retval;
702}
703
704template <int dim>
707RealVectND<dim>::round () const noexcept {
708 IntVectND<dim> retval;
709 for (int i=0; i<dim; ++i) {
710 retval[i] = static_cast<int>(std::round(vect[i]));
711 }
712 return retval;
713}
714
715template <int dim>
717Real
718RealVectND<dim>::sum () const noexcept {
719 Real retval = vect[0];
720 for (int i=1; i<dim; ++i) {
721 retval += vect[i];
722 }
723 return retval;
724}
725
726template <int dim>
728Real
730 Real len = this->radSquared();
731 len = std::sqrt(len);
732 return len;
733}
734
735template <int dim>
737Real
739 Real retval = vect[0] * vect[0];
740 for (int i=1; i<dim; ++i) {
741 retval += vect[i] * vect[i];
742 }
743 return retval;
744}
745
746template <int dim>
748Real
749RealVectND<dim>::product () const noexcept {
750 Real retval = vect[0];
751 for (int i=1; i<dim; ++i) {
752 retval *= vect[i];
753 }
754 return retval;
755}
756
757template <int dim>
759bool
760RealVectND<dim>::operator< (const RealVectND<dim>& p) const noexcept {
761 bool retval = vect[0] < p[0];
762 for (int i=1; i<dim; ++i) {
763 retval = retval && vect[i] < p[i];
764 }
765 return retval;
766}
767
768template <int dim>
770bool
771RealVectND<dim>::operator<= (const RealVectND<dim>& p) const noexcept {
772 bool retval = vect[0] <= p[0];
773 for (int i=1; i<dim; ++i) {
774 retval = retval && vect[i] <= p[i];
775 }
776 return retval;
777}
778
779template <int dim>
781bool
783 bool retval = vect[0] > p[0];
784 for (int i=1; i<dim; ++i) {
785 retval = retval && vect[i] > p[i];
786 }
787 return retval;
788}
789
790template <int dim>
792bool
794 bool retval = vect[0] >= p[0];
795 for (int i=1; i<dim; ++i) {
796 retval = retval && vect[i] >= p[i];
797 }
798 return retval;
799}
800
801template <int dim>
805 for (int i=0; i<dim; ++i) {
806 vect[i] = amrex::min(vect[i], p.vect[i]);
807 }
808 return *this;
809}
810
811template <int dim>
815 for (int i=0; i<dim; ++i) {
816 vect[i] = amrex::max(vect[i], p.vect[i]);
817 }
818 return *this;
819}
820
825template <int dim>
827RealVectND<dim> min (const RealVectND<dim>& p1, const RealVectND<dim>& p2) noexcept {
828 RealVectND<dim> p(p1);
829 return p.min(p2);
830}
831
836template <int dim>
838RealVectND<dim> max (const RealVectND<dim>& p1, const RealVectND<dim>& p2) noexcept {
839 RealVectND<dim> p(p1);
840 return p.max(p2);
841}
842
843template <int dim>
845Real
846RealVectND<dim>::dotProduct (const RealVectND<dim>& a_rhs) const noexcept {
847 Real retval = vect[0] * a_rhs.vect[0];
848 for (int i=1; i<dim; ++i) {
849 retval += vect[i] * a_rhs.vect[i];
850 }
851 return retval;
852}
853
854template <int dim>
858 requires (dim == 3)
859{
860 RealVectND<dim> tmp(vect[1] * a_rhs[2] - vect[2] * a_rhs[1],
861 vect[2] * a_rhs[0] - vect[0] * a_rhs[2],
862 vect[0] * a_rhs[1] - vect[1] * a_rhs[0]);
863 return tmp;
864}
865
866template <int dim>
870 for (int i=0; i<dim; ++i) {
871 vect[i] += s;
872 }
873 return *this;
874}
875
876template <int dim>
880 for (int i=0; i<dim; ++i) {
881 vect[i] += p[i];
882 }
883 return *this;
884}
885
886template <int dim>
890 for (int i=0; i<dim; ++i) {
891 vect[i] *= p[i];
892 }
893 return *this;
894}
895
896template <int dim>
900 RealVectND<dim> retval;
901 for (int i=0; i<dim; ++i) {
902 retval[i] = vect[i] * s;
903 }
904 return retval;
905}
906
907template <int dim>
911 RealVectND<dim> retval;
912 for (int i=0; i<dim; ++i) {
913 retval[i] = vect[i] - s;
914 }
915 return retval;
916}
917
918template <int dim>
922 RealVectND<dim> retval;
923 for (int i=0; i<dim; ++i) {
924 retval[i] = vect[i] + s;
925 }
926 return retval;
927}
928
929template <int dim>
933 for (int i=0; i<dim; ++i) {
934 vect[i] /= s;
935 }
936 return *this;
937}
938
939template <int dim>
943 for (int i=0; i<dim; ++i) {
944 vect[i] /= p[i];
945 }
946 return *this;
947}
948
949template <int dim>
953 RealVectND<dim> retval;
954 for (int i=0; i<dim; ++i) {
955 retval[i] = vect[i] / s;
956 }
957 return retval;
958}
959
960template <int dim>
962int
963RealVectND<dim>::minDir (const bool& a_doAbs) const noexcept {
964 int mDir = 0;
965 for (int idir = 0; idir < dim; idir++) {
966 if (a_doAbs) {
967 if (std::abs(vect[idir]) < std::abs(vect[mDir])) {
968 mDir = idir;
969 }
970 } else {
971 if (vect[idir] < vect[mDir]) {
972 mDir = idir;
973 }
974 }
975 }
976 return mDir;
977}
978
979template <int dim>
981int
982RealVectND<dim>::maxDir (const bool& a_doAbs) const noexcept {
983 int mDir = 0;
984 for (int idir = 0; idir < dim; idir++) {
985 if (a_doAbs) {
986 if (std::abs(vect[idir]) > std::abs(vect[mDir])) {
987 mDir = idir;
988 }
989 } else {
990 if (vect[idir] > vect[mDir]) {
991 mDir = idir;
992 }
993 }
994 }
995 return mDir;
996}
997
1009template <int dim=AMREX_SPACEDIM>
1011RealVectND<dim> BASISREALV (int dir) noexcept {
1012 AMREX_ASSERT(dir >= 0 && dir < dim);
1013 RealVectND<dim> tmp{0.};
1014 tmp[dir] = 1;
1015 return tmp;
1016}
1017
1022
1027template <int dim>
1030 RealVectND<dim> retval;
1031 for (int i=0; i<dim; ++i) {
1032 retval[i] = s / p[i];
1033 }
1034 return retval;
1035}
1036
1041template <int dim>
1044 RealVectND<dim> retval;
1045 for (int i=0; i<dim; ++i) {
1046 retval[i] = p[i] + s;
1047 }
1048 return retval;
1049}
1050
1054template <int dim>
1057 RealVectND<dim> retval;
1058 for (int i=0; i<dim; ++i) {
1059 retval[i] = s - p[i];
1060 }
1061 return retval;
1062}
1063
1068template <int dim>
1071 RealVectND<dim> retval;
1072 for (int i=0; i<dim; ++i) {
1073 retval[i] = s * p[i];
1074 }
1075 return retval;
1076}
1077
1081template <int dim>
1084 RealVectND<dim> retval;
1085 for (int i=0; i<dim; ++i) {
1086 retval[i] = s[i] / p[i];
1087 }
1088 return retval;
1089}
1090
1094template <int dim>
1097 RealVectND<dim> retval;
1098 for (int i=0; i<dim; ++i) {
1099 retval[i] = p[i] + s[i];
1100 }
1101 return retval;
1102}
1103
1107template <int dim>
1110 RealVectND<dim> retval;
1111 for (int i=0; i<dim; ++i) {
1112 retval[i] = s[i] - p[i];
1113 }
1114 return retval;
1115}
1116
1120template <int dim>
1123 RealVectND<dim> retval;
1124 for (int i=0; i<dim; ++i) {
1125 retval[i] = p[i] * s[i];
1126 }
1127 return retval;
1128}
1129
1134template <int dim>
1137 RealVectND<dim> retval;
1138 for (int i=0; i<dim; ++i) {
1139 retval[i] = s * p[i];
1140 }
1141 return retval;
1142}
1143
1145namespace detail {
1146
1147 template<int dim>
1149 void RealVectCat_imp (Real*& dst, const RealVectND<dim>& src) noexcept {
1150 for (int i=0; i<dim; ++i) {
1151 dst[i] = src[i];
1152 }
1153 dst += dim;
1154 }
1155
1156 template<int dim>
1158 void RealVectSplit_imp2 (RealVectND<dim>& dst, const Real*& src) noexcept {
1159 for (int i=0; i<dim; ++i) {
1160 dst[i] = src[i];
1161 }
1162 src += dim;
1163 }
1164
1165 template<class T, std::size_t...Ns>
1167 T RealVectSplit_imp (T& retval, std::index_sequence<Ns...>, const Real * src) noexcept {
1168 (RealVectSplit_imp2(amrex::get<Ns>(retval), src), ...);
1169 return retval;
1170 }
1171}
1173
1180template<int dim>
1181std::ostream&
1182operator<< (std::ostream& os, const RealVectND<dim>& p)
1183{
1184 return detail::T_vector_write(os, p.begin(), dim);
1185}
1186
1195template<int dim>
1196std::istream&
1197operator>> (std::istream& is, RealVectND<dim>& p)
1198{
1199 return detail::T_vector_read(is, p.begin(), dim);
1200}
1201
1206template<int d, int...dims>
1209constexpr RealVectND<detail::get_sum<d, dims...>()>
1210RealVectCat (const RealVectND<d>& v, const RealVectND<dims>&...vects) noexcept {
1211 RealVectND<detail::get_sum<d, dims...>()> retval {0.};
1212 Real* dst = retval.begin();
1213 detail::RealVectCat_imp(dst, v);
1214 (detail::RealVectCat_imp(dst, vects), ...);
1215 return retval;
1216}
1217
1222template<int d, int...dims>
1225constexpr GpuTuple<RealVectND<d>, RealVectND<dims>...>
1226RealVectSplit (const RealVectND<detail::get_sum<d, dims...>()>& v) noexcept {
1228 return detail::RealVectSplit_imp(retval,
1229 std::make_index_sequence<1 + sizeof...(dims)>(),
1230 v.begin());
1231}
1232
1237template<int new_dim, int old_dim>
1240constexpr RealVectND<new_dim>
1242 return iv.template shrink<new_dim>();
1243}
1244
1249template<int new_dim, int old_dim>
1252constexpr RealVectND<new_dim>
1253RealVectExpand (const RealVectND<old_dim>& iv, Real fill_extra=0) noexcept {
1254 return iv.template expand<new_dim>(fill_extra);
1255}
1256
1261template<int new_dim, int old_dim>
1264constexpr RealVectND<new_dim>
1265RealVectResize (const RealVectND<old_dim>& iv, Real fill_extra=0) noexcept {
1266 return iv.template resize<new_dim>(fill_extra);
1267}
1268
1271} // namespace amrex
1272
1273// Spcialize std::tuple_size for RealVectND. Used by structured bindings.
1274template<int dim>
1275struct std::tuple_size<amrex::RealVectND<dim>> {
1276 static constexpr std::size_t value = dim;
1277};
1278
1279// Spcialize std::tuple_element for RealVectND. Used by structured bindings.
1280template<std::size_t s, int dim>
1281struct std::tuple_element<s, amrex::RealVectND<dim>> {
1283};
1284
1285#endif
#define BL_ASSERT(EX)
Definition AMReX_BLassert.H:39
#define AMREX_ASSERT(EX)
Definition AMReX_BLassert.H:38
Integer-lattice boxes and helpers for defining index-space regions.
#define AMREX_FORCE_INLINE
Definition AMReX_Extension.H:124
#define AMREX_GPU_HOST_DEVICE
Definition AMReX_GpuQualifiers.H:20
int idir
Definition AMReX_HypreMLABecLap.cpp:1135
GPU-compatible tuple.
Definition AMReX_Tuple.H:104
An Integer Vector in dim-Dimensional Space.
Definition AMReX_IntVect.H:149
A Real vector in dim-dimensional space.
Definition AMReX_RealVect.H:34
__host__ __device__ bool operator<=(const RealVectND &p) const noexcept
Definition AMReX_RealVect.H:771
__host__ __device__ constexpr const Real & get() const noexcept
Returns a reference to the i'th coordinate of the RealVectND. Used by structured bindings.
Definition AMReX_RealVect.H:144
__host__ __device__ RealVectND & operator*=(Real s) noexcept
Definition AMReX_RealVect.H:637
__host__ __device__ constexpr Real * begin() noexcept
Definition AMReX_RealVect.H:167
__host__ __device__ int maxDir(const bool &a_doAbs) const noexcept
Definition AMReX_RealVect.H:982
__host__ __device__ constexpr Real * end() noexcept
Definition AMReX_RealVect.H:181
constexpr RealVectND() noexcept
Definition AMReX_RealVect.H:45
__host__ __device__ RealVectND & max(const RealVectND &p) noexcept
Definition AMReX_RealVect.H:814
__host__ __device__ RealVectND< new_dim > shrink() const noexcept
Returns a new RealVectND of size new_dim and assigns the first new_dim values of this RealVectND to i...
Definition AMReX_RealVect.H:553
__host__ __device__ RealVectND operator-() const noexcept
Definition AMReX_RealVect.H:664
__host__ __device__ constexpr bool operator==(const RealVectND &p) const noexcept
Definition AMReX_RealVect.H:205
__host__ static __device__ constexpr int isize() noexcept
Definition AMReX_RealVect.H:541
__host__ __device__ RealVectND & operator+=(Real s) noexcept
Definition AMReX_RealVect.H:869
RealVectND(const std::vector< Real > &vr) noexcept
Definition AMReX_RealVect.H:47
__host__ __device__ Real dotProduct(const RealVectND &a_rhs) const noexcept
Definition AMReX_RealVect.H:846
__host__ __device__ IntVectND< dim > round() const noexcept
Definition AMReX_RealVect.H:707
__host__ static __device__ constexpr RealVectND TheZeroVector() noexcept
Definition AMReX_RealVect.H:522
__host__ __device__ RealVectND crossProduct(const RealVectND &a_rhs) const noexcept
Definition AMReX_RealVect.H:857
__host__ __device__ constexpr const Real * begin() const noexcept
Definition AMReX_RealVect.H:174
__host__ __device__ RealVectND operator/(Real s) const noexcept
Definition AMReX_RealVect.H:952
__host__ __device__ RealVectND operator+() const noexcept
Definition AMReX_RealVect.H:657
__host__ __device__ bool operator>=(const RealVectND &p) const noexcept
Definition AMReX_RealVect.H:793
__host__ __device__ const Real * dataPtr() const noexcept
Definition AMReX_RealVect.H:483
__host__ __device__ constexpr RealVectND(Real s) noexcept
Definition AMReX_RealVect.H:67
__host__ __device__ RealVectND & scale(Real s) noexcept
Definition AMReX_RealVect.H:675
__host__ __device__ Real radSquared() const noexcept
Definition AMReX_RealVect.H:738
__host__ __device__ bool operator<(const RealVectND &p) const noexcept
Definition AMReX_RealVect.H:760
__host__ __device__ Real sum() const noexcept
Definition AMReX_RealVect.H:718
__host__ static __device__ constexpr std::size_t size() noexcept
Definition AMReX_RealVect.H:536
__host__ __device__ constexpr RealVectND(const IntVectND< dim > &iv) noexcept
Definition AMReX_RealVect.H:91
Real & operator[](int i) &&=delete
__host__ __device__ constexpr const Real * end() const noexcept
Definition AMReX_RealVect.H:188
Real vect[dim]
Definition AMReX_RealVect.H:591
__host__ __device__ Real product() const noexcept
Definition AMReX_RealVect.H:749
__host__ __device__ constexpr Real & get() noexcept
Returns a reference to the i'th coordinate of the RealVectND. Used by structured bindings.
Definition AMReX_RealVect.H:139
__host__ __device__ Real vectorLength() const noexcept
Definition AMReX_RealVect.H:729
__host__ __device__ bool operator>(const RealVectND &p) const noexcept
Definition AMReX_RealVect.H:782
__host__ __device__ RealVectND operator*(Real s) const noexcept
Definition AMReX_RealVect.H:899
__host__ __device__ int minDir(const bool &a_doAbs) const noexcept
Definition AMReX_RealVect.H:963
__host__ __device__ constexpr RealVectND(const GpuArray< Real, dim > ga) noexcept
Definition AMReX_RealVect.H:102
__host__ __device__ IntVectND< dim > floor() const noexcept
Definition AMReX_RealVect.H:685
__host__ __device__ IntVectND< dim > ceil() const noexcept
Definition AMReX_RealVect.H:696
__host__ __device__ RealVectND & operator/=(Real s) noexcept
Definition AMReX_RealVect.H:932
__host__ static __device__ constexpr RealVectND TheUnitVector() noexcept
Definition AMReX_RealVect.H:529
static const RealVectND Unit
Definition AMReX_RealVect.H:509
static const RealVectND Zero
Definition AMReX_RealVect.H:503
__host__ __device__ constexpr GpuArray< Real, dim > to_array() const noexcept
Definition AMReX_RealVect.H:147
__host__ __device__ RealVectND & operator-=(Real s) noexcept
Definition AMReX_RealVect.H:627
__host__ __device__ RealVectND< new_dim > resize(Real fill_extra=0.) const noexcept
Returns a new RealVectND of size new_dim by either shrinking or expanding this RealVectND.
Definition AMReX_RealVect.H:579
Real value_type
Definition AMReX_RealVect.H:545
__host__ __device__ Real * dataPtr() noexcept
Definition AMReX_RealVect.H:490
__host__ __device__ RealVectND(const Real *a) noexcept
Definition AMReX_RealVect.H:79
__host__ __device__ RealVectND< new_dim > expand(Real fill_extra=0.) const noexcept
Returns a new RealVectND of size new_dim and assigns all values of this RealVectND to it andĀ fill_ext...
Definition AMReX_RealVect.H:564
__host__ __device__ RealVectND & min(const RealVectND &p) noexcept
Definition AMReX_RealVect.H:804
__host__ __device__ constexpr bool operator!=(const RealVectND &p) const noexcept
Definition AMReX_RealVect.H:219
amrex_real Real
Floating Point Type for Fields.
Definition AMReX_REAL.H:80
__host__ __device__ constexpr const T & min(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:31
__host__ __device__ constexpr const T & max(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:53
Definition AMReX_Amr.cpp:50
std::ostream & operator<<(std::ostream &os, AmrMesh const &amr_mesh)
Stream helper; forwards to the friend declared inside AmrMesh.
Definition AMReX_AmrMesh.cpp:1372
__host__ __device__ constexpr RealVectND< new_dim > RealVectExpand(const RealVectND< old_dim > &iv, Real fill_extra=0) noexcept
Returns a new RealVectND of size new_dim and assigns all values of iv to it andĀ fill_extra to the rem...
Definition AMReX_RealVect.H:1253
__host__ __device__ GpuComplex< T > operator*(const GpuComplex< T > &a_x, const GpuComplex< U > &a_y) noexcept
Multiply two complex numbers.
Definition AMReX_GpuComplex.H:257
__host__ __device__ RealVectND< dim > BASISREALV(int dir) noexcept
Definition AMReX_RealVect.H:1011
constexpr bool IsConvertible_v
Definition AMReX_TypeTraits.H:256
RealVectND< 3 > RealVect
Definition AMReX_ParmParse.H:39
__host__ __device__ constexpr IntVectND< dim > scale(const IntVectND< dim > &p, int s) noexcept
Returns a IntVectND obtained by multiplying each of the components of this IntVectND by s.
Definition AMReX_IntVect.H:1106
__host__ __device__ GpuComplex< T > operator/(const GpuComplex< T > &a_x, const GpuComplex< T > &a_y) noexcept
Divide a complex number by another one.
Definition AMReX_GpuComplex.H:293
__host__ __device__ constexpr GpuTuple< RealVectND< d >, RealVectND< dims >... > RealVectSplit(const RealVectND< detail::get_sum< d, dims... >()> &v) noexcept
Returns a tuple of RealVectND obtained by splitting the input RealVectND according to the dimensions ...
Definition AMReX_RealVect.H:1226
__host__ __device__ constexpr RealVectND< detail::get_sum< d, dims... >()> RealVectCat(const RealVectND< d > &v, const RealVectND< dims > &...vects) noexcept
Returns a RealVectND obtained by concatenating the input RealVectNDs. The dimension of the return val...
Definition AMReX_RealVect.H:1210
__host__ __device__ constexpr RealVectND< new_dim > RealVectResize(const RealVectND< old_dim > &iv, Real fill_extra=0) noexcept
Returns a new RealVectND of size new_dim by either shrinking or expanding iv.
Definition AMReX_RealVect.H:1265
std::istream & operator>>(std::istream &is, BoxND< dim > &bx)
Read a BoxND from is.
Definition AMReX_Box.H:1965
__host__ __device__ constexpr RealVectND< new_dim > RealVectShrink(const RealVectND< old_dim > &iv) noexcept
Returns a new RealVectND of size new_dim and assigns the first new_dim values of iv to it.
Definition AMReX_RealVect.H:1241
__host__ __device__ XDim3 operator-(XDim3 const &a, XDim3 const &b)
Component-wise subtraction of two XDim3 structs.
Definition AMReX_Dim3.H:73
__host__ __device__ XDim3 operator+(XDim3 const &a, XDim3 const &b)
Component-wise addition of two XDim3 structs.
Definition AMReX_Dim3.H:62
Fixed-size array that can be used on GPU.
Definition AMReX_Array.H:52
amrex::Real type
Definition AMReX_RealVect.H:1282