67 Pstream::gatherList(surfBb);
72 if (Pstream::master())
76 Info<<
"processor" << proci <<
nl;
83 Info<<
"\tMesh bounds : ";
91 Info<<
"\tSurface bounding box : " << surfBb[proci] <<
nl
92 <<
"\tTriangles : " <<
nFaces[proci] <<
nl
93 <<
"\tVertices : " <<
nPoints[proci]
102int main(
int argc,
char *argv[])
106 "Redistribute a triSurface."
107 " The specified surface must be located in the constant/triSurface"
111 argList::addArgument(
"triSurfaceMesh");
112 argList::addArgument(
"distributionType");
113 argList::addBoolOption
116 "Preserve surface outside of mesh bounds"
121 runTime.functionObjects().off();
125 const label distType =
126 distributedTriSurfaceMesh::distributionTypeNames_[distTypeName];
128 Info<<
"Reading surface from " << surfFileName <<
nl <<
nl
129 <<
"Using distribution method "
130 << distTypeName <<
nl <<
endl;
132 const bool keepNonMapped =
args.
found(
"keepNonMapped");
136 Info<<
"Preserving surface outside of mesh bounds." <<
nl <<
endl;
140 Info<<
"Removing surface outside of mesh bounds." <<
nl <<
endl;
144 if (!Pstream::parRun())
147 <<
"Please run this program on the decomposed case."
148 <<
" It will read surface " << surfFileName
149 <<
" and decompose it such that it overlaps the mesh bounding box."
159 if (distType == distributedTriSurfaceMesh::INDEPENDENT)
170 decompositionModel::canonicalName,
183 dictPtr->
rename(decompositionModel::canonicalName);
189 if (distType == distributedTriSurfaceMesh::FOLLOW)
201 Pstream::allGatherList(
meshBb);
216 const fileName actualPath(typeFilePath<searchableSurface>(
io));
218 localPath.replace(
runTime.rootPath() +
'/',
"");
223 if (actualPath ==
io.objectPath())
225 Info<<
"Loading local (decomposed) surface " << localPath <<
nl <<
endl;
230 Info<<
"Loading undecomposed surface " << localPath
231 <<
" on master only" <<
endl;
235 if (Pstream::master())
238 const bool oldParRun = Pstream::parRun(
false);
240 Pstream::parRun(oldParRun);
250 dict.add(
"distributionType", distTypeName);
251 dict.add(
"mergeDistance", SMALL);
252 dict.add(
"bounds", bbs);
255 Pstream::scatter(
s.patches());
259 notReadIO.readOpt(IOobject::NO_READ);
267 Info<<
"Before redistribution:" <<
endl;
272 Info<<
"Redistributing surface" <<
nl <<
endl;
277 meshBb[Pstream::myProcNo()],
289 Info<<
"After redistribution:" <<
endl;
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
T get(const label index) const
Get a value from the argument at index.
bool found(const word &optName) const
Return true if the named option is found.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void clear() noexcept
Same as reset(nullptr)
void reset(autoPtr< T > &&other) noexcept
Delete managed object and set to new given pointer.
A bounding box defined in terms of min/max extrema points.
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...
A class for handling file names.
virtual void rename(const word &newName)
Rename.
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.
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.
const labelList nFaces(UPstream::listGatherValues< label >(aMesh.nFaces()))
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))
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
List< treeBoundBox > meshBb(1, treeBoundBox(boundBox(coarseMesh.points(), false)).extend(rndGen, 1e-3))
Foam::argList args(argc, argv)
#define forAll(list, i)
Loop across all elements in list.