Go to the documentation of this file.
36 #define MPICH_SKIP_MPICXX
37 #define OMPI_SKIP_MPICXX
54 "sizeof(Foam::label) == sizeof(SCOTCH_Num), check your scotch headers"
82 void Foam::scotchDecomp::graphPath(
const polyMesh&
mesh)
const
84 graphPath_ =
mesh.time().path()/
mesh.name() +
".grf";
88 void Foam::scotchDecomp::check(
const int retVal,
const char* str)
93 <<
"Call to scotch routine " << str <<
" failed.\n"
105 const List<scalar>& cWeights,
110 if (coeffsDict_.lookupOrDefault(
"writeGraph",
false))
112 OFstream str(graphPath_);
114 Info<<
"Dumping Scotch graph file to " << str.name() <<
nl
115 <<
"Use this in combination with gpart." <<
endl;
120 str << xadj.size()-1 <<
' ' << adjncy.size() <<
nl;
123 const label baseval = 0;
126 const label hasEdgeWeights = 0;
127 const label hasVertexWeights = 0;
128 const label numericflag = 10*hasEdgeWeights+hasVertexWeights;
129 str << baseval <<
' ' << numericflag <<
nl;
131 for (
label celli = 1; celli < xadj.size(); ++celli)
140 str <<
' ' << adjncy[i];
147 SCOTCH_randomReset();
153 SCOTCH_Strat stradat;
154 check(SCOTCH_stratInit(&stradat),
"SCOTCH_stratInit");
157 if (coeffsDict_.readIfPresent(
"strategy", strategy))
161 Info<<
"scotchDecomp : Using strategy " << strategy <<
endl;
163 SCOTCH_stratGraphMap(&stradat, strategy.c_str());
177 const scalar minWeights =
min(cWeights);
178 if (!cWeights.empty())
183 <<
"Illegal minimum weight " << minWeights
187 if (cWeights.size() != xadj.size()-1)
190 <<
"Number of cell weights " << cWeights.size()
191 <<
" does not equal number of cells " << xadj.size()-1
195 scalar velotabSum =
sum(cWeights)/minWeights;
197 scalar rangeScale(1.0);
199 if (velotabSum > scalar(
labelMax - 1))
203 rangeScale = 0.9*scalar(
labelMax - 1)/velotabSum;
206 <<
"Sum of weights has overflowed integer: " << velotabSum
207 <<
", compressing weight scale by a factor of " << rangeScale
212 velotab.setSize(cWeights.size());
216 velotab[i] = int((cWeights[i]/minWeights - 1)*rangeScale) + 1;
221 SCOTCH_Graph grafdat;
222 check(SCOTCH_graphInit(&grafdat),
"SCOTCH_graphInit");
240 check(SCOTCH_graphCheck(&grafdat),
"SCOTCH_graphCheck");
248 check(SCOTCH_archInit(&archdat),
"SCOTCH_archInit");
253 coeffsDict_.readIfPresent(
"processorWeights", processorWeights)
254 && processorWeights.size()
259 Info<<
"scotchDecomp : Using procesor weights " << processorWeights
262 if (processorWeights.size() != nDomains_)
265 <<
"processorWeights not the same size"
266 <<
" as the wanted number of domains " << nDomains_
274 &archdat, nDomains_, processorWeights.begin()
283 SCOTCH_archCmplt(&archdat, nDomains_),
331 int oldExcepts = fedisableexcept
339 decomp.setSize(xadj.size()-1);
354 feenableexcept(oldExcepts);
371 SCOTCH_graphExit(&grafdat);
373 SCOTCH_stratExit(&stradat);
375 SCOTCH_archExit(&archdat);
385 metisLikeDecomp(typeName, decompDict, selectionType::NULL_DICT)
391 const dictionary& decompDict,
395 metisLikeDecomp(typeName, decompDict,
regionName, selectionType::NULL_DICT)
403 const polyMesh&
mesh,
422 const polyMesh&
mesh,
449 graphPath_ =
"scotch.grf";
int debug
Static debugging option.
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
List< label > labelList
A List of labels.
vectorField pointField
pointField is a vectorField.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual label decomposeSerial(const labelList &adjncy, const labelList &xadj, const List< scalar > &cWeights, labelList &decomp) const
Decompose non-parallel.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
messageStream Info
Information stream (uses stdout - output is on the master only)
Macros for easy insertion into run-time selection tables.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const std::string version
OpenFOAM version (name or stringified number) as a std::string.
virtual labelList decompose(const polyMesh &mesh, const pointField &points, const scalarField &pointWeights) const
Return for every coordinate the wanted processor number.
scotchDecomp(const scotchDecomp &)=delete
No copy construct.
List< labelList > labelListList
A List of labelList.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
label ListType::const_reference const label start
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
virtual labelList decompose(const polyMesh &mesh, const pointField &points, const scalarField &pointWeights) const
Return for every coordinate the wanted processor number.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
defineTypeNameAndDebug(combustionModel, 0)
#define WarningInFunction
Report a warning using Foam::Warning.