20 Eigen::Matrix<real, 3, 3>
m{};
24 std::vector<std::unordered_set<index>> BuildNode2NodeFromCells(
27 std::vector<std::unordered_set<index>> node2nodeV(nLocalNodes);
35 node2nodeV[iN].insert(iNOther);
41 std::vector<std::vector<MatElem>> AllocateBlockSparseMatrix(
42 const std::vector<std::unordered_set<index>> &node2nodeV,
45 std::vector<std::vector<MatElem>> A(nLocalNodes);
46 for (
index iN = 0; iN < nLocalNodes; iN++)
48 A[iN].resize(node2nodeV[iN].size() + 1);
51 for (
auto iNOther : node2nodeV[iN])
52 A[iN][curRowEnd++].
j = iNOther;
53 for (
auto &ME : A[iN])
61 const std::vector<std::vector<MatElem>> &A,
64 for (
index iN = 0; iN <
x.father->Size(); iN++)
67 for (
const auto &ME : A[iN])
68 Ax[iN] += ME.
m *
x[ME.
j];
70 Ax.trans.startPersistentPull();
71 Ax.trans.waitPersistentPull();
75 void BlockJacobiPrecondition(
76 const std::vector<std::vector<MatElem>> &A,
79 for (
index iN = 0; iN <
x.father->Size(); iN++)
80 ADIx[iN] = A[iN][0].
m.fullPivLu().solve(
x[iN]);
81 ADIx.trans.startPersistentPull();
82 ADIx.trans.waitPersistentPull();
95 auto &nodesBoundInterpolated =
setup.nodesBoundInterpolated;
96 auto &boundInterpCoo =
setup.boundInterpCoo;
102 log() <<
"RBF set: " << boundInterpCoo.son->Size() << std::endl;
105 using kdtree_t = nanoflann::KDTreeSingleIndexAdaptor<
106 nanoflann::L2_Simple_Adaptor<real, PointCloudKDTreeCoordPair>,
117 v.InitPair(
"V2::dof",
mpi);
121 v.trans.createMPITypes();
122 v.trans.initPersistentPull();
145 dispO2.trans.startPersistentPull();
146 dispO2.trans.waitPersistentPull();
218 JDet =
J(EigenAll, 0).cross(
J(EigenAll, 1)).stableNorm();
220 JDet =
J.determinant();
222 JInv({0, 1}, {0, 1}) =
J({0, 1}, {0, 1}).
inverse().eval();
224 JInv =
J.inverse().eval();
225 return std::make_tuple(
J,
JInv, JDet);
245 Eigen::Matrix<real, 6, 6>
DStruct;
250 DStruct({0, 1, 2}, {0, 1, 2}) +=
muu * tJacobi::Identity();
256 vInc(EigenAll, EigenLast).setZero();
281 for (
auto &
ME :
A[
iN])
316 for (
auto &
ME :
A[
iN])
318 nDiag =
ME.m.array().abs().maxCoeff();
320 for (
auto &
ME :
A[
iN])
322 ME.m = tJacobi::Identity() *
nDiag;
332 for (
auto &
ME :
A[
iN])
334 nDiag =
ME.m.array().abs().maxCoeff();
336 for (
auto &
ME :
A[
iN])
338 ME.m = tJacobi::Identity() *
nDiag;
346 for (
auto &
ME :
A[
iN])
348 nDiag =
ME.m.array().abs().maxCoeff();
349 for (
auto &
ME :
A[
iN])
356 bO2.trans.startPersistentPull();
357 bO2.trans.waitPersistentPull();
362 log() << fmt::format(
363 "UnstructuredMesh === ElevatedNodesSolveInternalSmooth(): "
364 "Matrix Assembled, nFix {}, nFixB {} ",
382 {
return a.
dot(
b); },
389 log() << fmt::format(
"iRestart [{}] res [{:3e}] -> [{:3e}]",
Pre-compiled-header style shim that includes the heavy Eigen headers under DNDSR's warning suppressio...
#define DNDS_assert(expr)
Debug-only assertion (compiled out when DNDS_NDEBUG is defined). Prints the expression + file/line + ...
#define DNDS_MPI_InsertCheck(mpi, info)
Debug helper: barrier + print "CHECK <info> RANK r @ fn @ file:line".
Eigen::Matrix< real, 3, 3 > m
bool solve(TFA &&FA, TFML &&FML, TFDot &&fDot, TDATA &b, TDATA &x, uint32_t nRestart, TFstop &&FStop)
tJacobi ShapeJacobianCoordD01Nj(const tCoordsIn &cs, Eigen::Ref< const tD01Nj > DiNj)
Eigen::Matrix< t_real, 4, Eigen::Dynamic > tD01Nj
DNDS::ArrayPair< DNDS::ArrayEigenVector< 3 > > tCoordPair
Eigen::Matrix< real, 3, Eigen::Dynamic > tSmallCoords
std::optional< SmoothSolverSetup > PrepareSmoothSolverSetup(UnstructuredMesh &mesh)
Common preamble for all smooth solver variants.
DNDS::ArrayAdjacencyPair< DNDS::NonUniformSize > tAdjPair
void AllreduceOneIndex(index &v, MPI_Op op, const MPIInfo &mpi)
Single-scalar Allreduce helper for indices (in-place, count = 1).
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).
DNDS_CONSTANT const real UnInitReal
Sentinel "not initialised" real value (NaN). Cheap to detect with std::isnan or IsUnInitReal; survive...
Eigen::Matrix< real, Eigen::Dynamic, Eigen::Dynamic > MatrixXR
Column-major dynamic Eigen matrix of reals (default layout).
DNDS_CONSTANT const real largeReal
Loose upper bound (e.g., for non-dimensional limits).
int64_t index
Global row / DOF index type (signed 64-bit; handles multi-billion-cell meshes).
double real
Canonical floating-point scalar used throughout DNDSR (double precision).
std::ostream & log()
Return the current DNDSR log stream (either std::cout or the installed file).
ssp< TArray > father
Owned-side array (must be resized before ghost setup).
index Size() const
Combined row count (father->Size() + son->Size()).
TTrans trans
Ghost-communication engine bound to father and son.
real dot(CoordPairDOF &R)
DNDS_DEVICE_CALLABLE auto GetVectorByBits(const Eigen::Matrix< real, dim, nVec > &v, const NodePeriodicBits &bits)
UnstructuredMeshDeviceView< B > t_deviceView
Elem::Element GetCellElement(index iC)
tPbiPair cell2nodePbi
periodic only, after reader
tCoordPair coordsElevDisp
only elevation
void GetCoordsOnCell(index iCell, tSmallCoords &cs)
void ElevatedNodesSolveInternalSmoothV2()
struct DNDS::Geom::UnstructuredMesh::ElevationInfo elevationInfo
AdjPairTracked< tAdjPair > cell2node
int rank
This rank's 0-based index within comm (-1 until initialised).
Eigen::Matrix< real, 5, 1 > v
if(g_mpi.rank==0) std auto[rhsDensity, rhsEnergy, incL2]
for(int i=0;i< 10;i++) theta(i