62 <<
"Cannot read file " << filename <<
nl
86 string line = this->getLineNoComment(is);
89 while (
line.removeEnd(
'\\'))
91 line += this->getLineNoComment(is);
94 const auto tokens = stringOps::splitSpace(line);
97 if (tokens.size() < 2)
102 const word cmd = word::validate(tokens[0]);
113 readScalar(tokens[1]),
114 readScalar(tokens[2]),
115 readScalar(tokens[3])
124 const word groupName = word::validate(tokens[1]);
125 const auto iterGroup = groupLookup.
cfind(groupName);
127 if (iterGroup.good())
129 if (zoneId != *iterGroup)
137 zoneId = dynSizes.
size();
138 groupLookup.
insert(groupName, zoneId);
139 dynNames.
append(groupName);
154 groupLookup.
insert(
"zone0", 0);
162 for (
const auto& tok : tokens)
171 std::string vrtSpec(tok.str());
175 const auto slash = vrtSpec.find(
'/');
176 slash != std::string::npos
179 vrtSpec.erase(slash);
189 if (faceTraits<Face>::isTri() &&
f.size() > 3)
193 for (label fp1 = 1; fp1 <
f.size() - 1; fp1++)
195 const label fp2 =
f.fcIndex(fp1);
197 dynFaces.
append(Face{
f[0],
f[fp1],
f[fp2]});
202 else if (
f.size() >= 3)
213 this->storedPoints().
transfer(dynPoints);
215 this->sortFacesAndStore(dynFaces, dynZones, dynElemId, sorted);
218 this->addZones(dynSizes, dynNames);
249 const bool useFaceMap = (surf.
useFaceMap() && zones.size() > 1);
255 <<
"Cannot write file " << filename <<
nl
261 <<
"o " <<
os.name().stem() <<
nl
263 <<
"# points : " << pointLst.
size() <<
nl
264 <<
"# faces : " << faceLst.
size() <<
nl
265 <<
"# zones : " << zones.size() <<
nl;
270 os <<
"# " << zonei <<
" " << zones[zonei].name()
271 <<
" (nFaces: " << zones[zonei].size() <<
")" <<
nl;
275 <<
"# <points count=\"" << pointLst.
size() <<
"\">" << nl;
278 for (
const point& pt : pointLst)
280 os <<
"v " << pt.x() <<
' ' << pt.y() <<
' ' << pt.z() << nl;
283 os <<
"# </points>" <<
nl
285 <<
"# <faces count=\"" << faceLst.
size() <<
"\">" <<
nl;
290 for (
const surfZone& zone : zones)
292 if (zone.name().size())
294 os <<
"g " << zone.name() <<
nl;
297 for (label nLocal = zone.size(); nLocal--; ++faceIndex)
300 (useFaceMap ?
faceMap[faceIndex] : faceIndex);
302 const Face&
f = faceLst[facei];
305 for (
const label verti :
f)
307 os <<
' ' << (verti + 1);
312 os <<
"# </faces>" <<
nl;
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
void append(const T &val)
Copy append an element to the end of this list.
void push_back(const T &val)
Copy append an element to the end of this list.
A HashTable similar to std::unordered_map.
const_iterator cfind(const Key &key) const
Find and return an const_iterator set at the hashed entry.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
void transfer(HashTable< T, Key, Hash > &rhs)
Transfer contents into this table.
Input from file stream as an ISstream, normally using std::ifstream for the actual input.
A simple container for options an IOstream can normally have.
streamFormat format() const noexcept
Get the current stream format.
@ ASCII
"ascii" (normal default)
bool good() const noexcept
True if next operation might succeed.
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats.
const UList< surfZone > & surfZones() const noexcept
Const access to the surface zones.
const UList< Face > & surfFaces() const noexcept
Return const access to the faces.
const labelUList & faceMap() const noexcept
Const access to the faceMap, zero-sized when unused.
const pointField & points() const noexcept
Return const access to the points.
bool useFaceMap() const noexcept
Can/should use faceMap?
pointField & storedPoints()
Non-const access to global points.
virtual void addZones(const UList< surfZone > &, const bool cullEmpty=false)
Add surface zones.
void sortFacesAndStore(DynamicList< Face > &unsortedFaces, DynamicList< label > &zoneIds, DynamicList< label > &elemIds, bool sorted)
Sort faces by zones and store sorted faces.
bool addZonesToFaces()
Propagate zone information on face regions.
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
T & first()
Access first element of the list, position [0].
void size(const label n)
Older name for setAddressableSize.
static std::string dateTime()
The current wall-clock date/time (in local time) as a string in ISO-8601 format (yyyy-mm-ddThh:mm:ss)...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
static bool isTri()
Face-type only handles triangles. Not true in general.
A class for handling file names.
A surface zone on a MeshedSurface.
A class for handling words, derived from Foam::string.
static word validate(const std::string &s, const bool prefix=false)
Construct validated word (no invalid characters).
const word & name() const noexcept
The zone name.
Base class for mesh zones.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
Foam::SubStrings splitSpace(const std::string &str, std::string::size_type pos=0)
Split string into sub-strings at whitespace (TAB, NL, VT, FF, CR, SPC).
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
List< surfZone > surfZoneList
List of surfZone.
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
vector point
Point is a vector.
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)
UList< label > labelUList
A UList of labels.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.