61 #ifndef MPICH_SKIP_MPICXX 62 #define MPICH_SKIP_MPICXX 64 #ifndef OMPI_SKIP_MPICXX 65 #define OMPI_SKIP_MPICXX 68 #pragma GCC diagnostic ignored "-Wold-style-cast" 107 ZOLTAN_ID_PTR global_ids,
108 ZOLTAN_ID_PTR local_ids,
117 const auto nCells =
mesh.nCells();
121 const auto myProcOffset =
122 mesh.globalData().globalMeshCellAddr().localStart(myProci);
125 std::iota(global_ids, (global_ids + nCells), ZOLTAN_ID_TYPE(myProcOffset));
128 std::iota(local_ids, (local_ids + nCells), ZOLTAN_ID_TYPE(0));
153 ZOLTAN_ID_PTR global_ids,
154 ZOLTAN_ID_PTR local_ids,
162 if ((sizeGID != 1) || (sizeLID != 1) || (num_obj !=
mesh.nCells()))
164 *ierr = ZOLTAN_FATAL;
168 const Foam::label nCells = num_obj;
170 for (Foam::label i=0; i < nCells; ++i)
172 const Foam::label celli = local_ids[i];
175 for (
const auto facei :
mesh.cells()[celli])
177 if (
mesh.isInternalFace(facei))
184 numEdges[i] = numNbr;
196 ZOLTAN_ID_PTR global_ids,
197 ZOLTAN_ID_PTR local_ids,
199 ZOLTAN_ID_PTR nborGID,
213 || (num_obj !=
mesh.nCells())
217 *ierr = ZOLTAN_FATAL;
223 const auto myProcOffset =
224 mesh.globalData().globalMeshCellAddr().localStart(myProci);
226 auto* nextNbor = nborGID;
227 auto* nextProc = nborProc;
228 auto* nextWgt = ewgts;
230 const Foam::label nCells = num_obj;
232 for (Foam::label i=0; i < nCells; ++i)
234 const Foam::label celli = local_ids[i];
237 for (
const auto facei :
mesh.cells()[celli])
239 if (
mesh.isInternalFace(facei))
241 Foam::label nbr =
mesh.faceOwner()[facei];
244 nbr =
mesh.faceNeighbour()[facei];
247 *nextNbor++ = (nbr + myProcOffset);
248 *nextProc++ = myProci;
256 if (numNbr != num_edges[i])
258 *ierr = ZOLTAN_FATAL;
284 ZOLTAN_ID_PTR global_ids,
285 ZOLTAN_ID_PTR local_ids,
296 (num_gid_entries != 1)
297 || (num_lid_entries != 1)
298 || (num_obj !=
mesh.nCells())
299 || (num_dim !=
mesh.nSolutionD())
302 *ierr = ZOLTAN_FATAL;
313 reinterpret_cast<const Foam::point::cmptType*>(cc.
cdata()),
321 double*
p = geom_vec;
325 const Foam::label nCells = num_obj;
328 for (Foam::label celli = 0; celli < nCells; ++celli)
351 Foam::zoltanRenumber::zoltanRenumber(
const dictionary&
dict)
353 renumberMethod(
dict),
354 coeffsDict_(
dict.optionalSubDict(typeName +
"Coeffs"))
373 int rc = Zoltan_Initialize(
args.
size(),
args.strings(), &ver);
381 struct Zoltan_Struct *zz = Zoltan_Create(MPI_COMM_WORLD);
384 const bool verbose =
true;
387 Zoltan_Set_Param(zz,
"ORDER_METHOD",
"LOCAL_HSFC");
391 Info<< typeName <<
" : default ORDER_METHOD = LOCAL_HSFC" <<
nl 392 << typeName <<
" : default ORDER_TYPE = LOCAL" <<
nl;
395 for (
const entry& dEntry : coeffsDict_)
397 const word&
key = dEntry.keyword();
409 if (!dEntry.isDict())
411 const word value(dEntry.get<word>());
416 <<
" : setting parameter " 417 <<
key <<
" = " << value <<
nl;
420 Zoltan_Set_Param(zz,
key.c_str(), value.c_str());
425 Zoltan_Set_Param(zz,
"ORDER_TYPE",
"LOCAL");
429 polyMesh&
mesh =
const_cast<polyMesh&
>(pMesh);
444 const auto nCells =
mesh.nCells();
446 List<ZOLTAN_ID_TYPE> globalIds(nCells);
447 List<ZOLTAN_ID_TYPE> oldToNew(nCells);
451 const label myProcOffset =
452 mesh.globalData().globalMeshCellAddr().localStart(myProci);
456 std::iota(globalIds.begin(), globalIds.end(), ZOLTAN_ID_TYPE(myProcOffset));
458 int err = Zoltan_Order
467 if (err != ZOLTAN_OK)
486 [=](
const ZOLTAN_ID_TYPE id) -> label {
return (
id - myProcOffset); }
static void get_num_edges_list(void *data, int sizeGID, int sizeLID, int num_obj, ZOLTAN_ID_PTR global_ids, ZOLTAN_ID_PTR local_ids, int *numEdges, int *ierr)
static int get_mesh_dim(void *data, int *ierr)
static void get_vertex_list(void *data, int sizeGID, int sizeLID, ZOLTAN_ID_PTR global_ids, ZOLTAN_ID_PTR local_ids, int wgt_dim, float *obj_wgts, int *ierr)
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr char nl
The newline '\n' character (0x0a)
static bool initNull()
Special purpose initialisation function.
static void get_geom_list(void *data, int num_gid_entries, int num_lid_entries, int num_obj, ZOLTAN_ID_PTR global_ids, ZOLTAN_ID_PTR local_ids, int num_dim, double *geom_vec, int *ierr)
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Can be negative if the process i...
Macros for easy insertion into run-time selection tables.
static void get_edge_list(void *data, int sizeGID, int sizeLID, int num_obj, ZOLTAN_ID_PTR global_ids, ZOLTAN_ID_PTR local_ids, int *num_edges, ZOLTAN_ID_PTR nborGID, int *nborProc, int wgt_dim, float *ewgts, int *ierr)
label size() const noexcept
The number of arguments.
Templated 3D Vector derived from VectorSpace adding construction from 3 components, element access using x(), y() and z() member functions and the inner-product (dot-product) and cross-product operators.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
defineTypeNameAndDebug(combustionModel, 0)
static int get_number_of_vertices(void *data, int *ierr)
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual labelList renumber(const polyMesh &mesh) const
Return the cell visit order (from ordered back to original cell id) uses the mesh for connectivity an...
const T * cdata() const noexcept
Return pointer to the underlying array serving as data storage.
Mesh consisting of general polyhedral cells.
An adapter for copying a list of C++ strings into a list of C-style strings for passing to C code tha...
List< label > labelList
A List of labels.
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Foam::argList args(argc, argv)
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)