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)
123 return _p_indices[
j];
129 return _p_indices[
j];
132 operator std::vector<NodePeriodicBits>() const
134 return {_p_indices, _p_indices + _row_size};
140 std::copy(
r.begin(),
r.end(), _p_indices);
148 std::copy(
r.cbegin(),
r.cend(), _p_indices);
157 for (
auto &
v : *
this)
169 template <rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
174 using t_base::t_base;
184 template <rowsize _row_size = 1, rowsize _row_max = _row_size, rowsize _align = NoAlign>
196 r.map().setIdentity();
212 auto cwd = serializerP->GetCurrentPath();
213 serializerP->CreatePath(name);
214 serializerP->GoToPath(name);
216 for (
int i = 1;
i <= 3;
i++)
223 serializerP->GoToPath(cwd);
228 auto cwd = serializerP->GetCurrentPath();
230 serializerP->GoToPath(name);
232 for (
int i = 1;
i <= 3;
i++)
234 std::vector<real> rotRead, rotCRead, transRead;
236 serializerP->ReadRealVector(
"rotation" + std::to_string(
i), rotRead, offsetV);
237 serializerP->ReadRealVector(
"rotationCenter" + std::to_string(
i), rotCRead, offsetV);
238 serializerP->ReadRealVector(
"translation" + std::to_string(
i), transRead, offsetV);
244 serializerP->GoToPath(cwd);
271 template <
int dim,
int nVec>
280 if constexpr (dim == 3)
283 return rotation.at(
i).map()({0, 1}, {0, 1}) *
v;
286 template <
int dim,
int nVec>
295 if constexpr (dim == 3)
298 return rotation.at(
i).map()({0, 1}, {0, 1}).transpose() *
v;
310 if constexpr (dim == 3)
313 return rotation.at(
i).map()({0, 1}, {0, 1}) *
m *
rotation.at(
i).map()({0, 1}, {0, 1}).transpose();
325 if constexpr (dim == 3)
328 return rotation.at(
i).map()({0, 1}, {0, 1}).transpose() *
m *
rotation.at(
i).map()({0, 1}, {0, 1});
337 ret = this->
TransCoord(ret, BC_ID_PERIODIC_3);
339 ret = this->
TransCoord(ret, BC_ID_PERIODIC_2);
341 ret = this->
TransCoord(ret, BC_ID_PERIODIC_1);
345 template <
int dim,
int nVec>
350 Eigen::Matrix<real, dim, nVec> ret =
v;
352 ret = this->TransVector<dim, nVec>(ret, BC_ID_PERIODIC_3);
354 ret = this->TransVector<dim, nVec>(ret, BC_ID_PERIODIC_2);
356 ret = this->TransVector<dim, nVec>(ret, BC_ID_PERIODIC_1);
374 template <
int dim,
int nVec>
379 Eigen::Matrix<real, dim, nVec> ret =
v;
381 ret = this->TransVectorBack<dim, nVec>(ret, BC_ID_PERIODIC_1);
383 ret = this->TransVectorBack<dim, nVec>(ret, BC_ID_PERIODIC_2);
385 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 + ...
Eigen::Matrix< real, 3, 3 > m
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()
NodePeriodicBitsRow(NodePeriodicBitsRow &&)=default
NodePeriodicBitsRow & operator=(NodePeriodicBitsRow &&)=default
void operator=(const NodePeriodicBitsRow &r)
const NodePeriodicBits * cbegin() const
NodePeriodicBitsRow(const NodePeriodicBitsRow &)=default
NodePeriodicBits & operator[](rowsize j)
void operator=(const std::vector< NodePeriodicBits > &r)
~NodePeriodicBitsRow()=default
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
DNDS_CONSTANT const index UnInitIndex
Sentinel "not initialised" index value (= INT64_MIN).
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)