70 typedef std::tuple<label, label, point, point> surfTuple;
72 List<surfTuple> surfaceInfo;
78 surfTuple(
s.points().size(),
s.size(), bb.min(), bb.max())
86 Info<<
"processor" << proci <<
nl;
88 const auto& [
nPoints, nFaces, smin, smax] = surfaceInfo[proci];
89 const auto& bbs =
meshBb[proci];
95 Info<<
"\tMesh bounds : ";
103 Info<<
"\tSurface bounding box : " << smin <<
' ' << smax <<
nl
104 <<
"\tTriangles : " << nFaces <<
nl
113int main(
int argc,
char *argv[])
117 "Redistribute a triSurface."
118 " The specified surface must be located in the constant/triSurface"
127 "Preserve surface outside of mesh bounds"
132 runTime.functionObjects().off();
135 const auto distTypeName =
args.get<
word>(2);
136 const label distType =
139 Info<<
"Reading surface from " << surfFileName <<
nl <<
nl
140 <<
"Using distribution method "
141 << distTypeName <<
nl <<
endl;
143 const bool keepNonMapped =
args.found(
"keepNonMapped");
147 Info<<
"Preserving surface outside of mesh bounds." <<
nl <<
endl;
151 Info<<
"Removing surface outside of mesh bounds." <<
nl <<
endl;
158 <<
"Please run this program on the decomposed case."
159 <<
" It will read surface " << surfFileName
160 <<
" and decompose it such that it overlaps the mesh bounding box."
227 localPath.replace(
runTime.rootPath() +
'/',
"");
232 if (actualPath ==
io.objectPath())
234 Info<<
"Loading local (decomposed) surface " << localPath <<
nl <<
endl;
239 Info<<
"Loading undecomposed surface " << localPath
240 <<
" on master only" <<
endl;
243 List<treeBoundBox> bbs;
259 dict.add(
"distributionType", distTypeName);
260 dict.add(
"mergeDistance", SMALL);
261 dict.add(
"bounds", bbs);
276 Info<<
"Before redistribution:" <<
endl;
281 Info<<
"Redistributing surface" <<
nl <<
endl;
298 Info<<
"After redistribution:" <<
endl;
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
@ REGISTER
Request registration (bool: true).
@ NO_READ
Nothing to be read.
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
static IOobject selectIO(const IOobject &io, const fileName &altFile, const word &ioName="")
Return the IOobject, but also consider an alternative file name.
static void allGatherList(UList< T > &values, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Gather data, but keep individual values separate. Uses MPI_Allgather or manual communication.
static void broadcast(Type &value, const int communicator=UPstream::worldComm)
Broadcast content (contiguous or non-contiguous) to all communicator ranks. Does nothing in non-paral...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
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 parRun(const bool on) noexcept
Set as parallel run on/off.
static List< T > listGatherValues(const T &localValue, const int communicator=UPstream::worldComm)
Gather individual values into list locations.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run.
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
static void addNote(const string ¬e)
Add extra notes for the usage information.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void clear() noexcept
Same as reset(nullptr).
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
static const boundBox greatBox
A large boundBox: min/max == -/+ ROOTVGREAT.
static const word canonicalName
The canonical name ("decomposeParDict") under which the MeshObject is registered.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
IOoject and searching on distributed triSurface. All processor hold (possibly overlapping) part of th...
static const Enum< distributionType > distributionTypeNames_
A class for handling file names.
virtual void rename(const word &newName)
Rename.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
A surface mesh consisting of general polygon faces that has IO capabilities and a registry for storin...
Standard boundBox with extra functionality for use in octree.
treeBoundBox extend(Random &rndGen, const scalar s) const
Return slightly wider bounding box.
static const treeBoundBox & null() noexcept
The null treeBoundBox is the same as an inverted box.
IOoject and searching on triSurface.
Triangulated surface description with patch information.
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).
List< treeBoundBox > meshBb(1, treeBoundBox(coarseMesh.points()).extend(rndGen, 1e-3))
Foam::argList args(argc, argv)
#define forAll(list, i)
Loop across all elements in list.