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;
272 return mesh.nSolutionD();
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;
321 double*
p = geom_vec;
325 const Foam::label nCells = num_obj;
328 for (Foam::label celli = 0; celli < nCells; ++celli)
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");
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); }
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
An adapter for copying a list of C++ strings into a list of C-style strings for passing to C code tha...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void clear()
Clear the list, i.e. set size to zero.
iterator begin() noexcept
Return an iterator to begin traversing the UList.
iterator end() noexcept
Return an iterator to end traversing the UList.
const T * cdata() const noexcept
Return pointer to the underlying array serving as data storage.
void size(const label n)
Older name for setAddressableSize.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
static bool initNull()
Special purpose initialisation function.
static constexpr direction nComponents
Number of components in this vector space.
Cmpt cmptType
Component type.
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A keyword and a list of tokens is an 'entry'.
Mesh consisting of general polyhedral cells.
Abstract base class for renumbering.
renumberMethod()
Default construct.
A class for handling words, derived from Foam::string.
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...
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr auto key(const Type &t) noexcept
Helper function to return the enum value.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere).
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
vector point
Point is a vector.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).
Foam::argList args(argc, argv)
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)
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)
static int get_number_of_vertices(void *data, int *ierr)
static int get_mesh_dim(void *data, int *ierr)
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 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)