14 [[nodiscard]]
bool getP1()
const {
return __v & 0x01U; }
15 [[nodiscard]]
bool getP2()
const {
return __v & 0x02U; }
16 [[nodiscard]]
bool getP3()
const {
return __v & 0x04U; }
23 return uint8_t(
__v ^
r.__v);
39 return uint8_t(
r) == uint8_t(*
this);
41 static MPI_Datatype
CommType() {
return MPI_UINT8_T; }
51 static const NodePeriodicBits nodePB1{0x01U};
52 static const NodePeriodicBits nodePB2{0x02U};
53 static const NodePeriodicBits nodePB3{0x04U};
77 return uint8_t(
pbi) < uint8_t(
r.pbi);
84 return r.i ==
i &&
r.pbi ==
pbi;
96 auto v0 = a[0] ^
b[0];
97 for (
size_t i = 1; i <
n; i++)
98 if ((a.at(i) ^
b.at(i)) != v0)
114 return __p_indices[j];
120 return __p_indices[j];
123 operator std::vector<NodePeriodicBits>() const
125 return std::vector<NodePeriodicBits>(__p_indices, __p_indices + __Row_size);
131 std::copy(
r.begin(),
r.end(), __p_indices);
137 std::copy(
r.cbegin(),
r.cend(), __p_indices);
146 for (
auto &
v : *
this)
158 template <rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
163 using t_base::t_base;
173 template <rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
185 r.map().setIdentity();
201 auto cwd = serializerP->GetCurrentPath();
202 serializerP->CreatePath(name);
203 serializerP->GoToPath(name);
205 for (
int i = 1; i <= 3; i++)
212 serializerP->GoToPath(cwd);
217 auto cwd = serializerP->GetCurrentPath();
219 serializerP->GoToPath(name);
221 for (
int i = 1; i <= 3; i++)
223 std::vector<real> rotRead, rotCRead, transRead;
225 serializerP->ReadRealVector(
"rotation" + std::to_string(i), rotRead, offsetV);
226 serializerP->ReadRealVector(
"rotationCenter" + std::to_string(i), rotCRead, offsetV);
227 serializerP->ReadRealVector(
"translation" + std::to_string(i), transRead, offsetV);
233 serializerP->GoToPath(cwd);
260 template <
int dim,
int nVec>
269 if constexpr (dim == 3)
272 return rotation.at(i).map()({0, 1}, {0, 1}) *
v;
275 template <
int dim,
int nVec>
284 if constexpr (dim == 3)
285 return rotation.at(i).map().transpose() *
v;
287 return rotation.at(i).map()({0, 1}, {0, 1}).transpose() *
v;
299 if constexpr (dim == 3)
302 return rotation.at(i).map()({0, 1}, {0, 1}) * m *
rotation.at(i).map()({0, 1}, {0, 1}).transpose();
314 if constexpr (dim == 3)
317 return rotation.at(i).map()({0, 1}, {0, 1}).transpose() * m *
rotation.at(i).map()({0, 1}, {0, 1});
326 ret = this->
TransCoord(ret, BC_ID_PERIODIC_3);
328 ret = this->
TransCoord(ret, BC_ID_PERIODIC_2);
330 ret = this->
TransCoord(ret, BC_ID_PERIODIC_1);
334 template <
int dim,
int nVec>
339 Eigen::Matrix<real, dim, nVec> ret =
v;
341 ret = this->TransVector<dim, nVec>(ret, BC_ID_PERIODIC_3);
343 ret = this->TransVector<dim, nVec>(ret, BC_ID_PERIODIC_2);
345 ret = this->TransVector<dim, nVec>(ret, BC_ID_PERIODIC_1);
363 template <
int dim,
int nVec>
368 Eigen::Matrix<real, dim, nVec> ret =
v;
370 ret = this->TransVectorBack<dim, nVec>(ret, BC_ID_PERIODIC_1);
372 ret = this->TransVectorBack<dim, nVec>(ret, BC_ID_PERIODIC_2);
374 ret = this->TransVectorBack<dim, nVec>(ret, BC_ID_PERIODIC_3);
Father-son array pairs with device views and ghost communication.
#define DNDS_DEVICE_TRIVIAL_COPY_DEFINE(T, T_Self)
#define DNDS_DEVICE_CALLABLE
#define DNDS_DEVICE_TRIVIAL_COPY_DEFINE_NO_EMPTY_CTOR(T, T_Self)
#define DNDS_assert(expr)
Debug-only assertion (compiled out when DNDS_NDEBUG is defined). Prints the expression + file/line + ...
Base types and abstract interface for array serialization.
Non-owning device-callable view of an Array, specialised per DeviceBackend.
T * operator[](index iRow)
Return a raw pointer to the start of row iRow.
rowsize RowSize() const
Uniform row width for fixed layouts (no row index needed).
index Size() const
Number of rows currently stored. O(1).
NodePeriodicBits * rowPtr(index i)
NodePeriodicBitsRow operator[](index i)
NodePeriodicBits bitandReduce()
void operator=(const NodePeriodicBitsRow &r)
const NodePeriodicBits * cbegin() const
NodePeriodicBits & operator[](rowsize j)
void operator=(const std::vector< NodePeriodicBits > &r)
NodePeriodicBits * begin()
NodePeriodicBits operator[](rowsize j) const
const NodePeriodicBits * cend() const
NodePeriodicBitsRow(NodePeriodicBits *ptr, rowsize siz)
MPI-aware Array: adds a communicator, rank, and global index mapping.
Describes one rank's window into a globally-distributed dataset.
Eigen::VectorXd STDVectorToVector(const std::vector< real > &v)
tJacobi STDVectorToJacobi(const std::vector< real > &v)
DNDS_DEVICE_CALLABLE bool FaceIDIsPeriodic(t_index id)
DNDS_DEVICE_CALLABLE bool FaceIDIsPeriodicDonor(t_index id)
bool isCollaborativeNodePeriodicBits(const std::vector< NodePeriodicBits > &a, const std::vector< NodePeriodicBits > &b)
std::vector< real > JacobiToSTDVector(const tJacobi &j)
std::vector< real > VectorToSTDVector(const Eigen::VectorXd &v)
ssp< SerializerBase > SerializerBaseSSP
the host side operators are provided as implemented
int32_t rowsize
Row-width / per-row element-count type (signed 32-bit).
int64_t index
Global row / DOF index type (signed 64-bit; handles multi-billion-cell meshes).
Convenience bundle of a father, son, and attached ArrayTransformer.
bool operator!=(const NodeIndexPBI &r) const
bool operator<(const NodeIndexPBI &r) const
bool operator==(const NodeIndexPBI &r) const
DNDS_DEVICE_CALLABLE bool operator==(const NodePeriodicBits &r) const
friend std::ostream & operator<<(std::ostream &o, const NodePeriodicBits &b)
DNDS_DEVICE_CALLABLE NodePeriodicBits operator&(const NodePeriodicBits &r) const
static MPI_Datatype CommType()
DNDS_HOST void WriteSerializer(Serializer::SerializerBaseSSP serializerP, const std::string &name)
DNDS_DEVICE_CALLABLE tPoint GetCoordBackByBits(const tPoint &c, const NodePeriodicBits &bits) const
std::array< tPointPortable, 4 > rotationCenter
DNDS_DEVICE_CALLABLE auto GetVectorByBits(const Eigen::Matrix< real, dim, nVec > &v, const NodePeriodicBits &bits)
DNDS_DEVICE_CALLABLE tPoint TransCoordBack(const tPoint &c, t_index id) const
DNDS_DEVICE_CALLABLE auto GetVectorBackByBits(const Eigen::Matrix< real, dim, nVec > &v, const NodePeriodicBits &bits)
std::array< tPointPortable, 4 > translation
std::array< tGPointPortable, 4 > rotation
DNDS_DEVICE_CALLABLE tPoint GetCoordByBits(const tPoint &c, const NodePeriodicBits &bits) const
DNDS_DEVICE_CALLABLE Eigen::Matrix< real, dim, nVec > TransVectorBack(const Eigen::Matrix< real, dim, nVec > &v, t_index id)
DNDS_DEVICE_CALLABLE Eigen::Matrix< real, dim, dim > TransMat(const Eigen::Matrix< real, dim, dim > &m, t_index id)
DNDS_DEVICE_CALLABLE Eigen::Matrix< real, dim, dim > TransMatBack(const Eigen::Matrix< real, dim, dim > &m, t_index id)
DNDS_HOST void ReadSerializer(Serializer::SerializerBaseSSP serializerP, const std::string &name)
DNDS_DEVICE_CALLABLE Eigen::Matrix< real, dim, nVec > TransVector(const Eigen::Matrix< real, dim, nVec > &v, t_index id)
DNDS_DEVICE_CALLABLE tPoint TransCoord(const tPoint &c, t_index id) const
Eigen::Matrix< real, 5, 1 > v
Eigen::Vector3d n(1.0, 0.0, 0.0)