12 using tPointMap = Eigen::Map<tPoint, Eigen::Unaligned>;
14 using tGPointMap = Eigen::Map<tGPoint, Eigen::Unaligned>;
19 std::array<real, 3>
d;
34 std::array<real, 9>
d;
47 static_assert(std::is_trivially_copyable_v<tPointPortable>);
48 static_assert(std::is_trivially_copyable_v<tGPointPortable>);
55 return tSmallCoords::operator()(EigenAll, i);
60 return tSmallCoords::operator()(EigenAll, i);
64 static_assert(std::is_signed_v<t_index>);
74 std::vector<real> ret(9);
75 for (
int i = 0; i < 9; i++)
84 for (
int i = 0; i < 9; i++)
91 return {
v.begin(),
v.end()};
96 auto ret = Eigen::VectorXd(
v.size());
97 for (
size_t i = 0; i <
v.size(); i++)
115 static_assert(d == 2 || d == 3);
116 if constexpr (d == 2)
119 DNDS_assert_info(J(EigenAll, 1).norm() == 0,
"Must be a line in x-y plane");
120 DNDS_assert_info(J(EigenAll, 2).norm() == 0,
"Must be a line in x-y plane");
121 return tPoint{J(1, 0), -J(0, 0), 0};
123 if constexpr (d == 3)
126 return J(EigenAll, 0).cross(J(EigenAll, 1));
135 inline Eigen::Matrix<real, dim, dim>
NormBuildLocalBaseV(
const Eigen::Ref<
const Eigen::Vector<real, dim>> &uNorm)
137 Eigen::Matrix<real, dim, dim> base;
138 static_assert(dim == 2 || dim == 3,
"dim is bad");
139 if constexpr (dim == 3)
141 base({0, 1, 2}, 0) = uNorm;
142 if (std::abs(uNorm(2)) < 0.9)
143 base({0, 1, 2}, 1) = -uNorm.cross(
tPoint{0, 0, 1}).normalized();
145 base({0, 1, 2}, 1) = -uNorm.cross(
tPoint{0, 1, 0}).normalized();
147 base({0, 1, 2}, 2) = base({0, 1, 2}, 0).cross(base({0, 1, 2}, 1)).normalized();
151 base({0, 1}, 0) = uNorm;
152 base(0, 1) = -uNorm(1);
153 base(1, 1) = uNorm(0);
161 return tGPoint{{cos(theta), -sin(theta), 0},
162 {sin(theta), cos(theta), 0},
170 {0, cos(theta), -sin(theta)},
171 {0, sin(theta), cos(theta)}};
178 {cos(theta), 0, sin(theta)},
180 {-sin(theta), 0, cos(theta)}};
185 real theta = axis.norm();
187 return tGPoint::Identity();
188 tPoint axn = axis / theta;
189 tGPoint Omega{{0, -axn(2), axn(1)},
190 {axn(2), 0, -axn(0)},
191 {-axn(1), axn(0), 0}};
192 return axn * axn.transpose() + std::sin(theta) * Omega - std::cos(theta) * (Omega * Omega);
197 return tGPoint{{0, -axn(2), axn(1)},
198 {axn(2), 0, -axn(0)},
199 {-axn(1), axn(0), 0}};
204 return tPoint{axnM(2, 1), axnM(0, 2), axnM(1, 0)};
212 r(Eigen::seq(Eigen::fix<0>, Eigen::fix<dim - 1>)) =
v;
Core type aliases, constants, and metaprogramming utilities for the DNDS framework.
#define DNDS_DEVICE_TRIVIAL_COPY_DEFINE(T, T_Self)
#define DNDS_DEVICE_CALLABLE
#define DNDS_assert_info(expr, info)
Debug-only assertion with an extra std::string info message.
#define DNDS_assert(expr)
Debug-only assertion (compiled out when DNDS_NDEBUG is defined). Prints the expression + file/line + ...
Eigen::Matrix< real, dim, dim > NormBuildLocalBaseV(const Eigen::Ref< const Eigen::Vector< real, dim > > &uNorm)
input uNorm should already be normalized
Eigen::VectorXd STDVectorToVector(const std::vector< real > &v)
tJacobi STDVectorToJacobi(const std::vector< real > &v)
tGPoint RotateAxis(const tPoint &axis)
Eigen::Map< tPoint, Eigen::Unaligned > tPointMap
Eigen::Map< const tGPoint, Eigen::Unaligned > tGPointConstMap
Eigen::Map< tGPoint, Eigen::Unaligned > tGPointMap
tPoint ToThreeDim(const Eigen::Vector< real, dim > &v)
tPoint FacialJacobianToNormVec(const tJacobi &J)
get normal vector from facial jacobian note that $$ J_{ij} = \partial_{\xi_j} x_i $$
Eigen::Matrix< real, 3, Eigen::Dynamic > tSmallCoords
Eigen::Map< const tPoint, Eigen::Unaligned > tPointConstMap
tGPoint CrossVecToMat(const tPoint &axn)
tPoint CrossMatToVec(const tGPoint &axnM)
std::vector< real > JacobiToSTDVector(const tJacobi &j)
const t_index invalid_index
std::vector< real > VectorToSTDVector(const Eigen::VectorXd &v)
std::vector< std::vector< index > > tLocalMatStruct
DNDS_CONSTANT const real pi
π in double precision (matches DNDS_E_PI macro).
double real
Canonical floating-point scalar used throughout DNDSR (double precision).
DNDS_CONSTANT const real smallReal
Loose lower bound (for iterative-solver tolerances etc.).
auto operator[](Eigen::Index i) const
auto operator[](Eigen::Index i)
DNDS_DEVICE_CALLABLE auto map()
DNDS_DEVICE_CALLABLE auto map() const
DNDS_DEVICE_CALLABLE auto map() const
DNDS_DEVICE_CALLABLE auto map()
Eigen::Matrix< real, 5, 1 > v
if(g_mpi.rank==0) std auto[rhsDensity, rhsEnergy, incL2]