51 template<
class GeoField>
55 const typename GeoField::Mesh&
mesh,
62 Info<<
"Subsetting " << GeoField::typeName
83 int main(
int argc,
char *argv[])
87 "select a mesh subset based on a cellSet"
98 "set of cells included in the sub-mesh"
104 "zone of cells included in the sub-mesh"
110 "add exposed internal faces to specified patch instead of to "
117 "specify a time for the resulting mesh"
122 "do not update fields"
146 word fieldsInstance = runTime.name();
154 if (specifiedInstance)
157 meshInstance = fieldsInstance;
169 const word patchName =
args[
"patch"];
180 Info<<
"Adding exposed internal faces to patch " << patchName <<
endl
185 Info<<
"Adding exposed internal faces to a patch called"
186 <<
" \"oldInternalFaces\" (created if necessary)" <<
endl
208 Info<<
"Selecting cellZone " << zoneName <<
endl <<
endl;
229 if (
patchi == -1 && subsetDict.found(
"patch"))
231 const word patchName(subsetDict.lookup(
"patch"));
244 if (subsetDict.isDict(
"zone"))
253 subsetDict.subDict(
"zone")
257 Info<<
"Selecting cellZone " << zg->zoneName()
258 <<
" of type " << zg->type() <<
endl;
260 subCells = zg->generate().cZone();
264 const word cellZoneName(subsetDict.lookup(
"zone"));
266 Info<<
"Selecting cellZone " << cellZoneName <<
endl;
281 #define SubsetTypeGeoFields(Type, GeoField, mesh) \
282 wordList Type##GeoField##Names \
284 objects.names(GeoField<Type>::typeName) \
286 PtrList<GeoField<Type>> Type##GeoField##s \
288 Type##GeoField##Names.size() \
294 Type##GeoField##Names, \
305 runTime.setTime(
instant(fieldsInstance), 0);
313 Info<<
"Writing mesh to ";
318 #define RenameTypeGeoFields(Type, GeoField) \
319 forAll(Type##GeoField##s, i) \
321 Type##GeoField##s[i].rename(Type##GeoField##Names[i]); \
322 Type##GeoField##s[i].write(); \
334 runTime.setTime(
instant(fieldsInstance), 0);
342 Info<<
"Writing mesh to ";
371 refData.topoChange(map);
#define forAll(list, i)
Loop across all elements in list.
static pointMesh & New(const word &name, const polyMesh &mesh)
Construct and return the named DemandDrivenMeshObject.
Generic GeometricField class.
List of IOobjects with searching and retrieving facilities.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
bool set(const label) const
Is element set.
static void addOption(const word &opt, const string ¶m="", const string &usage="")
Add to an option to validOptions with usage information.
static void addNote(const string &)
Add extra notes for the usage information.
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
bool optionFound(const word &opt) const
Return true if the named option is found.
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
T optionLookupOrDefault(const word &opt, const T &deflt) const
Read a value from the named option if present.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A collection of cell labels.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
const word & name() const
Return const reference to name.
Post-processing mesh subset tool. Given the original mesh and the list of selected cells,...
const fvMesh & baseMesh() const
Original mesh.
const labelList & cellMap() const
Return cell map.
void setLargeCellSubset(const labelList ®ion, const label currentRegion, const label patchID=-1, const bool syncCouples=true)
Set the subset from all cells with region == currentRegion.
const fvMesh & subMesh() const
Return reference to subset mesh.
const labelList & pointMap() const
Return point map.
static tmp< VolField< Type > > interpolate(const VolField< Type > &, const fvMesh &sMesh, const labelList &patchMap, const labelList &cellMap, const labelList &faceMap)
Map volume field.
const Time & time() const
Return the top-level database.
virtual bool write(const bool write=true) const
Write mesh using IO settings from time.
const word & name() const
Return reference to name.
Various for reading/decomposing/reconstructing/distributing refinement data.
An instant of time. Contains the time value and name.
Mesh representing a set of points created from polyMesh.
label findIndex(const word &patchName) const
Find patch index given a name.
wordList names() const
Return the list of patch names.
const fileName & facesInstance() const
Return the current instance directory for faces.
const cellZoneList & cellZones() const
Return cell zones.
static word defaultRegion
Return the default region name.
fileName meshDir() const
Return the local mesh directory (dbDir()/meshSubDir)
const fileName & pointsInstance() const
Return the current instance directory for points.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
void setInstance(const fileName &)
Set the instance for mesh files.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for handling words, derived from string.
static const word null
An empty word.
static autoPtr< zoneGenerator > New(const word &name, const polyMesh &mesh, const dictionary &dict)
Select constructed from name, mesh and dictionary.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
int main(int argc, char *argv[])
static List< word > fieldNames
gmvFile<< "tracers "<< particles.size()<< nl;{ pointField positions(particles.size());label particlei=0;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter) { positions[particlei++]=iter().position(mesh);} for(i=0;i< pTraits< point >::nComponents;i++) { forAll(positions, particlei) { gmvFile<< component(positions[particlei], i)<< ' ';} gmvFile<< nl;}}forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.name(), lagrangian::cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Info<< "Calculating turbulent flame speed field St\n"<< endl;volScalarField St(IOobject("St", runTime.name(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), flameWrinkling->Xi() *Su);multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
List< labelList > labelListList
A List of labelList.
typename VolField< Type >::Internal VolInternalField
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
FOR_ALL_FIELD_TYPES(makeFieldSourceTypedef)
IOdictionary systemDict(const word &dictName, const argList &args, const objectRegistry &ob, const word ®ionName=polyMesh::defaultRegion, const fileName &path=fileName::null)
Foam::argList args(argc, argv)