Go to the documentation of this file.
46 const label
n =
f.size();
52 << (groupId + 1) <<
','
61 << (groupId + 1) <<
','
71 for (label fp1 = 1; fp1 <
f.size() - 1; ++fp1)
73 const label fp2 =
f.fcIndex(fp1);
77 << (groupId + 1) <<
','
79 << (
f[fp1] + 1) <<
','
80 << (
f[fp2] + 1) <<
nl;
115 <<
"Cannot read file " << filename <<
nl
134 bool ignoreElemId =
false;
144 word ansaType, ansaName;
158 if (
line.starts_with(
"$ANSA_NAME"))
160 const auto sem0 =
line.find(
';', 0);
161 const auto sem1 =
line.find(
';', sem0+1);
162 const auto sem2 =
line.find(
';', sem1+1);
166 sem0 != std::string::npos
167 && sem1 != std::string::npos
168 && sem2 != std::string::npos
172 ansaType =
line.substr(sem1+1, sem2-sem1-1);
188 if (
line.starts_with(
"$HMNAME COMP") &&
line.find(
'"') != string::npos)
195 nameLookup.insert(groupId, groupName);
205 if (
line.size() > 72 &&
line[72] ==
'+')
214 if (buf.size() > 72 && buf[72] ==
'+')
216 line += buf.substr(8, 64);
220 line += buf.substr(8);
238 const auto iterZone = zoneLookup.cfind(groupId);
239 if (iterZone.found())
241 if (zoneId != *iterZone)
250 zoneId = dynSizes.size();
251 zoneLookup.insert(groupId, zoneId);
262 else if (cmd ==
"CQUAD4")
272 const auto iterZone = zoneLookup.cfind(groupId);
273 if (iterZone.found())
275 if (zoneId != *iterZone)
284 zoneId = dynSizes.size();
285 zoneLookup.insert(groupId, zoneId);
296 dynFaces.
append(Face{
c, d, a});
299 dynSizes[zoneId] += 2;
311 else if (cmd ==
"GRID")
314 (void) nextNasField(
line, linei, 8);
315 scalar
x = readNasScalar(nextNasField(
line, linei, 8));
316 scalar
y = readNasScalar(nextNasField(
line, linei, 8));
317 scalar z = readNasScalar(nextNasField(
line, linei, 8));
322 else if (cmd ==
"GRID*")
331 (void) nextNasField(
line, linei, 16);
332 scalar
x = readNasScalar(nextNasField(
line, linei, 16));
333 scalar
y = readNasScalar(nextNasField(
line, linei, 16));
340 <<
"Expected continuation symbol '*' when reading GRID*"
341 <<
" (double precision coordinate) format" <<
nl
346 (void) nextNasField(
line, linei, 8);
347 scalar z = readNasScalar(nextNasField(
line, linei, 16));
352 else if (cmd ==
"PSHELL")
356 if (groupId == ansaId && ansaType ==
"PSHELL")
359 nameLookup.insert(groupId, groupName);
363 else if (unhandledCmd.
insert(cmd))
365 Info<<
"Unhandled Nastran command " <<
line <<
nl
381 this->storedPoints().transfer(dynPoints);
390 mapPointId.insert(pointId[i], i);
395 for (Face&
f : dynFaces)
397 for (label& vert :
f)
399 vert = mapPointId[vert];
410 const label groupId = iter.key();
411 const label zoneId = iter.val();
413 const auto iterName = nameLookup.cfind(groupId);
414 if (iterName.found())
416 names[zoneId] = *iterName;
424 this->sortFacesAndStore(dynFaces, dynZones, dynElemId, sorted);
427 this->addZones(dynSizes, names);
428 this->addZonesToFaces();
444 streamOpt.
format(IOstream::ASCII);
455 ? surfaceFormatsCore::oneZone(faceLst,
"")
459 const bool useFaceMap = (surf.
useFaceMap() && zones.size() > 1);
463 bool useOrigFaceIds =
473 for (
const auto&
f : faceLst)
477 useOrigFaceIds =
false;
488 <<
"Cannot write file " << filename <<
nl
493 fileFormats::NASCore::setPrecision(os, fieldFormat::FREE);
502 os <<
"$HMNAME COMP" <<
setw(20) << (zonei+1)
503 <<
'"' << zones[zonei].
name() <<
'"' <<
nl;
507 os <<
"$ GRID POINTS" <<
nl
508 <<
"BEGIN BULK" <<
nl;
511 for (
const point& pt : pointLst)
516 << pt.x() <<
',' << pt.y() <<
',' << pt.z() <<
nl;
519 os <<
"$ ELEMENTS" <<
nl;
527 for (label nLocal =
zone.size(); nLocal--; ++faceIndex)
530 (useFaceMap ?
faceMap[faceIndex] : faceIndex);
532 const Face&
f = faceLst[facei];
536 elemId = elemIds[facei];
539 elemId = writeShell(os,
f, elemId, zoneIndex);
545 os <<
"ENDDATA" <<
nl;
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
static std::string nameLessExt(const std::string &str)
Return basename, without extension.
A class for handling words, derived from Foam::string.
ISstream & getLine(std::string &str, char delim='\n')
Raw, low-level getline (until delimiter) into a string.
A class for handling file names.
virtual const fileName & name() const
Read/write access to the name of the stream.
bool useFaceMap() const
Can/should use faceMap?
Input from file stream, using an ISstream.
virtual const fileName & name() const
Read/write access to the name of the stream.
thermo validate(args.executable(), "h")
Base class for mesh zones.
streamFormat format() const noexcept
Get the current stream format.
const pointField & points() const
Return const access to the points.
Ostream & endl(Ostream &os)
Add newline and flush stream.
DynamicList< T, SizeMin > & shrink()
Shrink the allocated space to the number of elements used.
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats.
const labelUList & faceMap() const
Const access to the faceMap, zero-sized when unused.
#define forAll(list, i)
Loop across all elements in list.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
messageStream Info
Information stream (uses stdout - output is on the master only)
word name(const complex &c)
Return string representation of complex.
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
void clear()
Clear the addressed list, i.e. set the size to zero.
The IOstreamOption is a simple container for options an IOstream can normally have.
Istream and Ostream manipulators taking arguments.
graph_traits< Graph >::vertices_size_type size_type
static const word defaultName("coeffs")
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Omanip< int > setw(const int i)
errorManipArg< error, int > exit(error &err, const int errNo=1)
Output to file stream, using an OSstream.
const labelUList & faceIds() const
Const access to the faceIds, zero-sized when unused.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
forAllConstIters(mixture.phases(), phase)
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
A surface zone on a MeshedSurface.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
void clearStorage()
Clear the list and delete storage.
const dimensionedScalar c
Speed of light in a vacuum.
label lineNumber() const
Const access to the current stream line number.
void size(const label n) noexcept
Override size to be inconsistent with allocated storage.
Various functions to operate on Lists.
const UList< Face > & surfFaces() const
Return const access to the faces.
vector point
Point is a vector.
bool good() const
Return true if next operation might succeed.
bool removeEnd(const std::string &text)
Remove the given text from the end of the string.
const UList< surfZone > & surfZones() const
Const access to the surface zones.