5 #include "AMReX_REAL.H"
6 #include "AMReX_SPACE.H"
7 #include "AMReX_Vector.H"
8 #include "AMReX_BLassert.H"
9 #include "AMReX_Geometry.H"
10 #include "AMReX_IndexType.H"
11 #include <eigen3/Eigen/Core>
12 #include <eigen3/Eigen/Geometry>
13 #include <eigen3/Eigen/SVD>
14 #include <AMReX_REAL.H>
20 using Vector = Eigen::Matrix<amrex::Real,AMREX_SPACEDIM,1>;
22 using Covector = Eigen::Matrix<amrex::Real,1,AMREX_SPACEDIM>;
23 using Matrix = Eigen::Matrix<amrex::Real,AMREX_SPACEDIM,AMREX_SPACEDIM>;
25 using iMatrix = Eigen::Matrix<int,AMREX_SPACEDIM,AMREX_SPACEDIM>;
30 return in.block<AMREX_SPACEDIM,AMREX_SPACEDIM>(0,0);
37 ret.block<AMREX_SPACEDIM,AMREX_SPACEDIM>(0,0) = in;
47 : Eigen::Quaterniond() {}
49 : Eigen::Quaterniond(w,x,y,z) {}
51 : Eigen::Quaterniond(R) {}
53 : Eigen::Quaterniond(q.w(),q.x(),q.y(),q.z()) {}
58 w() = rhs.w(); x() = rhs.x(); y() = rhs.y(); z() = rhs.z();
64 w() += rhs.w(); x() += rhs.x(); y() += rhs.y(); z() += rhs.z();
81 ret.w() = b.w()*alpha; ret.x() = b.x()*alpha; ret.y() = b.y()*alpha; ret.z() = b.z()*alpha;
88 ret.w() = b.w()*alpha; ret.x() = b.x()*alpha; ret.y() = b.y()*alpha; ret.z() = b.z()*alpha;
95 ret.w() = a.w()+b.w(); ret.x() = a.x()+b.x(); ret.y() = a.y()+b.y(); ret.z() = a.z()+b.z();
103 ret.w() = a.w()-b.w(); ret.x() = a.x()-b.x(); ret.y() = a.y()-b.y(); ret.z() = a.z()-b.z();
110 if (fabs((a.w() - b.w())/(a.w()+a.w())) > 1E-8)
return false;
111 if (fabs((a.x() - b.x())/(a.x()+a.x())) > 1E-8)
return false;
112 if (fabs((a.y() - b.y())/(a.y()+a.y())) > 1E-8)
return false;
113 if (fabs((a.z() - b.z())/(a.z()+a.z())) > 1E-8)
return false;
121 Vector Position(
const int &i,
const int &j,
const int &k,
const amrex::Geometry &geom,
const amrex::IndexType &ixType)
124 if (ixType == amrex::IndexType::TheNodeType())
127 geom.ProbLo()[0] + ((amrex::Real)(i)) * geom.CellSize()[0],
128 geom.ProbLo()[1] + ((amrex::Real)(j)) * geom.CellSize()[1],
129 geom.ProbLo()[2] + ((amrex::Real)(k)) * geom.CellSize()[2]));
131 else if (ixType == amrex::IndexType::TheCellType())
134 geom.ProbLo()[0] + ((amrex::Real)(i) + 0.5) * geom.CellSize()[0],
135 geom.ProbLo()[1] + ((amrex::Real)(j) + 0.5) * geom.CellSize()[1],
136 geom.ProbLo()[2] + ((amrex::Real)(k) + 0.5) * geom.CellSize()[2]));
139 return Set::Vector::Zero();
147 if (xmin) N(0) = -1.0;
148 else if (xmax) N(0) = 1.0;
150 if (ymin) N(1) = -1.0;
151 else if (ymax) N(1) = 1.0;
154 if (zmin) N(2) = -1.0;
155 else if (zmax) N(2) = 1.0;
164 size(0) = geom.ProbHi()[0] - geom.ProbLo()[0];
166 size(1) = geom.ProbHi()[1] - geom.ProbLo()[1];
169 size(2) = geom.ProbHi()[2] - geom.ProbLo()[2];
176 Vector Volume(
const int &i,
const int &j,
const int &k,
const amrex::Geometry &geom,
const amrex::IndexType &ixType)
179 if (ixType == amrex::IndexType::TheNodeType())
182 geom.ProbLo()[0] + ((amrex::Real)(i)) * geom.CellSize()[0],
183 geom.ProbLo()[1] + ((amrex::Real)(j)) * geom.CellSize()[1],
184 geom.ProbLo()[2] + ((amrex::Real)(k)) * geom.CellSize()[2]));
186 else if (ixType == amrex::IndexType::TheCellType())
189 geom.ProbLo()[0] + ((amrex::Real)(i) + 0.5) * geom.CellSize()[0],
190 geom.ProbLo()[1] + ((amrex::Real)(j) + 0.5) * geom.CellSize()[1],
191 geom.ProbLo()[2] + ((amrex::Real)(k) + 0.5) * geom.CellSize()[2]));
194 return Set::Vector::Zero();
199 template<
int dim,
int sym>