Go to the documentation of this file.
45 const label
n =
f.size();
51 << (groupId + 1) <<
','
60 << (groupId + 1) <<
','
70 for (label fp1 = 1; fp1 <
f.size() - 1; ++fp1)
72 const label fp2 =
f.fcIndex(fp1);
76 << (groupId + 1) <<
','
78 << (
f[fp1] + 1) <<
','
79 << (
f[fp2] + 1) <<
nl;
114 <<
"Cannot read file " << filename <<
nl
133 bool ignoreElemId =
false;
143 word ansaType, ansaName;
157 if (
line.starts_with(
"$ANSA_NAME"))
159 const auto sem0 =
line.find(
';', 0);
160 const auto sem1 =
line.find(
';', sem0+1);
161 const auto sem2 =
line.find(
';', sem1+1);
165 sem0 != std::string::npos
166 && sem1 != std::string::npos
167 && sem2 != std::string::npos
171 ansaType =
line.substr(sem1+1, sem2-sem1-1);
187 if (
line.starts_with(
"$HMNAME COMP") &&
line.find(
'"') != string::npos)
194 nameLookup.insert(groupId, groupName);
204 if (
line.size() > 72 &&
line[72] ==
'+')
213 if (buf.size() > 72 && buf[72] ==
'+')
215 line += buf.substr(8, 64);
219 line += buf.substr(8);
237 const auto iterZone = zoneLookup.cfind(groupId);
238 if (iterZone.found())
240 if (zoneId != *iterZone)
249 zoneId = dynSizes.size();
250 zoneLookup.insert(groupId, zoneId);
261 else if (cmd ==
"CQUAD4")
271 const auto iterZone = zoneLookup.cfind(groupId);
272 if (iterZone.found())
274 if (zoneId != *iterZone)
283 zoneId = dynSizes.size();
284 zoneLookup.insert(groupId, zoneId);
295 dynFaces.
append(Face{
c, d, a});
298 dynSizes[zoneId] += 2;
310 else if (cmd ==
"GRID")
313 (void) nextNasField(
line, linei, 8);
314 scalar
x = readNasScalar(nextNasField(
line, linei, 8));
315 scalar
y = readNasScalar(nextNasField(
line, linei, 8));
316 scalar z = readNasScalar(nextNasField(
line, linei, 8));
321 else if (cmd ==
"GRID*")
330 (void) nextNasField(
line, linei, 16);
331 scalar
x = readNasScalar(nextNasField(
line, linei, 16));
332 scalar
y = readNasScalar(nextNasField(
line, linei, 16));
339 <<
"Expected continuation symbol '*' when reading GRID*"
340 <<
" (double precision coordinate) format" <<
nl
345 (void) nextNasField(
line, linei, 8);
346 scalar z = readNasScalar(nextNasField(
line, linei, 16));
351 else if (cmd ==
"PSHELL")
355 if (groupId == ansaId && ansaType ==
"PSHELL")
358 nameLookup.insert(groupId, groupName);
362 else if (unhandledCmd.
insert(cmd))
364 Info<<
"Unhandled Nastran command " <<
line <<
nl
380 this->storedPoints().transfer(dynPoints);
389 mapPointId.insert(pointId[i], i);
394 for (Face&
f : dynFaces)
396 for (label& vert :
f)
398 vert = mapPointId[vert];
409 const label groupId = iter.key();
410 const label zoneId = iter.val();
412 const auto iterName = nameLookup.cfind(groupId);
413 if (iterName.found())
415 names[zoneId] = *iterName;
423 this->sortFacesAndStore(dynFaces, dynZones, dynElemId, sorted);
426 this->addZones(dynSizes, names);
427 this->addZonesToFaces();
443 streamOpt.
format(IOstream::ASCII);
454 ? surfaceFormatsCore::oneZone(faceLst,
"")
458 const bool useFaceMap = (surf.
useFaceMap() && zones.size() > 1);
461 bool useOrigFaceIds =
462 (!useFaceMap && elemIds.
size() == faceLst.
size());
468 for (
const auto&
f : faceLst)
472 useOrigFaceIds =
false;
483 <<
"Cannot write file " << filename <<
nl
488 fileFormats::NASCore::setPrecision(os, fieldFormat::FREE);
497 os <<
"$HMNAME COMP" <<
setw(20) << (zonei+1)
498 <<
'"' << zones[zonei].
name() <<
'"' <<
nl;
502 os <<
"$ GRID POINTS" <<
nl
503 <<
"BEGIN BULK" <<
nl;
506 for (
const point& pt : pointLst)
511 << pt.x() <<
',' << pt.y() <<
',' << pt.z() <<
nl;
514 os <<
"$ ELEMENTS" <<
nl;
522 for (label nLocal =
zone.size(); nLocal--; ++faceIndex)
525 (useFaceMap ?
faceMap[faceIndex] : faceIndex);
527 const Face&
f = faceLst[facei];
531 elemId = elemIds[facei];
534 elemId = writeShell(os,
f, elemId, zoneIndex);
540 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.
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.