Go to the documentation of this file.
41 { loadingOption::SINGLE_REGION,
"single" },
42 { loadingOption::FILE_REGION,
"file" },
43 { loadingOption::OFFSET_REGION,
"offset" },
44 { loadingOption::MERGE_REGION,
"merge" },
50 Foam::triSurfaceLoader::triSurfaceLoader(
const fileName& directory)
52 directory_(directory),
62 directory_(
runTime.constantPath()/
"triSurface"),
91 available_ =
names.sortedToc();
93 return available_.size();
99 selected_ = available_;
100 return selected_.size();
106 if (available_.found(
name))
115 return selected_.size();
130 const word& plain = mat;
131 if (available_.found(plain))
133 foundIds.append(available_[plain]);
138 <<
"Specified the surfaces " << mat <<
nl
139 <<
" - but could not find it"
144 selected_ =
wordList(available_, foundIds);
145 return selected_.size();
165 for (
const wordRe& mat : matcher)
172 for (
const label idx : indices)
174 if (hashedFound.insert(idx))
176 foundIds.append(idx);
182 const word& plain = mat;
183 if (available_.found(plain))
185 const label idx = available_[plain];
186 if (hashedFound.insert(idx))
188 foundIds.append(idx);
191 else if (hashedMissing.insert(plain))
193 missing.append(plain);
201 <<
"Specified the surfaces " <<
flatOutput(matcher) <<
nl
202 <<
" - but could not find " <<
flatOutput(missing)
206 selected_ =
wordList(available_, foundIds);
207 return selected_.size();
214 const scalar scaleFactor
219 if (selected_.empty())
223 else if (selected_.size() == 1)
232 opt == loadingOption::SINGLE_REGION
233 || opt == loadingOption::FILE_REGION
241 if (surf.patches().size())
247 surf.patches().append
270 triSurface addsurf(directory_/selected_[surfi]);
278 const label ptoff =
points.size();
291 case loadingOption::SINGLE_REGION:
306 case loadingOption::FILE_REGION:
322 case loadingOption::OFFSET_REGION:
329 const label regoff =
patches.size();
336 f.region() += regoff;
342 case loadingOption::MERGE_REGION:
349 forAll(addpatches, patchi)
352 const word& patchName =
p.name();
362 patchId = patchNameLookup[patchName];
365 oldToNew.insert(patchi,
patchId);
373 f.region() = oldToNew[
f.region()];
388 points.transfer(addpoints);
393 if (scaleFactor > VSMALL)
bool isPattern() const noexcept
The wordRe is treated as a pattern, not as literal string.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static Ostream & output(Ostream &os, const IntRange< T > &range)
loadingOption
The file loading options for triSurfaceLoader.
A class for handling words, derived from Foam::string.
A class for handling file names.
Identifies a surface patch/zone by name and index, with geometric type.
static const Enum< loadingOption > loadingOptionNames
The loading enumeration names.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
void append(const T &val)
Append an element at the end of the list.
const geometricSurfacePatchList & patches() const noexcept
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
#define forAll(list, i)
Loop across all elements in list.
List< word > wordList
A List of words.
void swapFaces(List< labelledTri > &faceLst)
Swap the list of faces being addressed.
label select(const word &name)
Populates 'selected' with a subset of the available files.
Triangulated surface description with patch information.
virtual void swapPoints(pointField &pts)
Swap points. Similar to movePoints, but returns the old points.
void setSize(const label n)
Alias for resize()
void transfer(List< T > &list)
void append(T *ptr)
Append an element to the end of the list.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
labelList findStrings(const regExp &matcher, const UList< StringType > &input, const bool invert=false)
Return list indices for strings matching the regular expression.
label readDir()
Read directory and populate the 'available' files.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
label selectAll()
Populates 'selected' with all available files.
const polyBoundaryMesh & patches
A triFace with additional (region) index.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
void size(const label n)
Older name for setAddressableSize.
List< word > names(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
fileNameList readDir(const fileName &directory, const fileName::Type type=fileName::FILE, const bool filtergz=true, const bool followLink=true)
Read a directory and return the entries as a fileName List.
autoPtr< triSurface > load(const enum loadingOption opt=loadingOption::OFFSET_REGION, const scalar scaleFactor=-1) const
Load a single file, or load and combine multiple selected files.
static bool canRead(const fileName &name, bool verbose=false)
Can we read this file format?