74 ZOLTAN_ID_PTR globalIDs,
75 ZOLTAN_ID_PTR localIDs,
92 const Foam::pointField& points = vertexData.
first();
95 if (wgt_dim != weights.
size()/points.size())
106 globalIDs[i] = globalMap.
toGlobal(i);
108 for(
int j=0; j<wgt_dim; j++)
110 obj_wgts[wgt_dim*i + j] = weights[wgt_dim*i + j];
130 ZOLTAN_ID_PTR globalIDs,
131 ZOLTAN_ID_PTR localIDs,
144 || (nPoints != points.
size())
148 *ierr = ZOLTAN_FATAL;
174 ZOLTAN_ID_PTR globalIDs,
175 ZOLTAN_ID_PTR localIDs,
185 if ((nGID != 1) || (nLID != 1) || (nPoints != sizes.size()))
187 *ierr = ZOLTAN_FATAL;
193 numEdges[i] = sizes[i];
206 ZOLTAN_ID_PTR globalIDs,
207 ZOLTAN_ID_PTR localIDs,
209 ZOLTAN_ID_PTR nborGID,
229 *ierr = ZOLTAN_FATAL;
236 nborProc[i] = globalMap.whichProcID(m[i]);
245 const CompactListList<label>& adjacency,
248 List<label>& finalDecomp
252 args[0] =
"zoltanDecomp";
254 int argc = args.size();
256 for (
label i = 0; i < argc; i++)
258 argv[i] = strdup(args[i].c_str());
262 int rc = Zoltan_Initialize(argc, argv, &ver);
272 const int nWeights = pWeights.size()/points.size();
275 Zoltan_Set_Param(zz,
"return_lists",
"export");
276 Zoltan_Set_Param(zz,
"obj_weight_dim",
name(nWeights).c_str());
277 Zoltan_Set_Param(zz,
"edge_weight_dim",
"0");
280 Zoltan_Set_Param(zz,
"debug_level",
"0");
281 Zoltan_Set_Param(zz,
"imbalance_tol",
"1.05");
284 Zoltan_Set_Param(zz,
"lb_method",
"graph");
285 Zoltan_Set_Param(zz,
"lb_approach",
"repartition");
287 if (decompositionDict_.found(
"zoltanCoeffs"))
289 const dictionary& coeffsDict_ =
290 decompositionDict_.subDict(
"zoltanCoeffs");
294 if (!iter().isDict())
296 const word& key = iter().keyword();
297 const word value(iter().stream());
301 Info<< typeName <<
" : setting parameter " << key
302 <<
" to " << value <<
endl;
305 Zoltan_Set_Param(zz, key.c_str(), value.c_str());
313 Tuple2<const pointField&, const scalarField&> vertexData(points, pWeights);
321 void* adjacencyPtr = &
const_cast<CompactListList<label>&
>(adjacency);
323 Zoltan_Set_Edge_List_Multi_Fn(zz,
get_edge_list, adjacencyPtr);
325 int changed, num_imp, num_exp, *imp_procs, *exp_procs;
326 int *imp_to_part, *exp_to_part;
327 int num_gid_entries, num_lid_entries;
328 ZOLTAN_ID_PTR imp_global_ids, exp_global_ids;
329 ZOLTAN_ID_PTR imp_local_ids, exp_local_ids;
334 int oldExcepts = fedisableexcept
363 feenableexcept(oldExcepts);
366 if (debug && changed)
368 Pout <<
"Zoltan number to move " << changed <<
" " << num_exp <<
endl;
371 finalDecomp.setSize(points.size());
376 for(
int i=0; i<num_exp; i++)
378 finalDecomp[exp_local_ids[i]] = exp_procs[i];
426 <<
"Can use this decomposition method only for the whole mesh" 428 <<
"and supply one coordinate (cellCentre) for every cell." <<
endl 429 <<
"The number of coordinates " << cellCentres.
size() <<
endl 430 <<
"The number of cells in the mesh " << mesh.
nCells()
460 decomp[i] = finalDecomp[i];
477 <<
"Size of cell-to-coarse map " << agglom.
size()
478 <<
" differs from number of cells in mesh " << mesh.
nCells()
506 forAll(fineDistribution, i)
508 fineDistribution[i] = finalDecomp[agglom[i]];
511 return fineDistribution;
522 if (points.
size() != globalPointPoints.
size())
525 <<
"Inconsistent number of cells (" << globalPointPoints.
size()
526 <<
") and number of cell centres (" << points.
size()
#define forAll(list, i)
Loop across all elements in list.
const UList< T > & m() const
Return the packed matrix of data.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
A 2-tuple for storing two objects of different types.
const Type1 & first() const
Return first.
static void get_geom_list(void *data, int nGID, int nLID, int nPoints, ZOLTAN_ID_PTR globalIDs, ZOLTAN_ID_PTR localIDs, int nDim, double *vertices, int *ierr)
void size(const label)
Override size to be inconsistent with allocated storage.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Holds information (coordinate and normal) regarding nearest wall point.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
Macros for easy insertion into run-time selection tables.
static void calcCellCells(const polyMesh &mesh, const labelList &agglom, const label nLocalCoarse, const bool global, CompactListList< label > &cellCells)
Helper: determine (local or global) cellCells from mesh.
pointField vertices(const blockVertexList &bvl)
zoltanDecomp(const dictionary &decompositionDict)
Construct given the decomposition dictionary and mesh.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
static const direction nComponents
Number of components in this vector space.
vectorField pointField
pointField is a vectorField.
static int get_number_of_vertices(void *data, int *ierr)
labelList sizes() const
Return sizes (to be used e.g. for construction)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
static void get_num_edges_list(void *data, int nGID, int nLID, int nPoints, ZOLTAN_ID_PTR globalIDs, ZOLTAN_ID_PTR localIDs, int *numEdges, int *ierr)
Abstract base class for decomposition.
A packed storage unstructured matrix of objects of type <T> using an offset table for access...
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
word name(const complex &)
Return a string representation of a complex.
static int get_mesh_dim(void *data, int *ierr)
List< string > stringList
A List of strings.
label toGlobal(const label i) const
From local to global.
prefixOSstream Pout(cout, "Pout")
const Type2 & second() const
Return second.
Mesh consisting of general polyhedral cells.
Foam::argList args(argc, argv)
static void get_vertex_list(void *data, int nGID, int nLID, ZOLTAN_ID_PTR globalIDs, ZOLTAN_ID_PTR localIDs, int wgt_dim, float *obj_wgts, int *ierr)
static void get_edge_list(void *data, int nGID, int nLID, int nPoints, ZOLTAN_ID_PTR globalIDs, ZOLTAN_ID_PTR localIDs, int *num_edges, ZOLTAN_ID_PTR nborGID, int *nborProc, int wgt_dim, float *ewgts, int *ierr)