52 size_t expSign =
s.find_last_of(
"+-");
54 if (expSign != string::npos && expSign > 0 && !
isspace(
s[expSign-1]))
59 if (
s[expSign] ==
'-')
63 return mantissa*
pow(10, exponent);
72 bool triSurface::readNAS(
const fileName& fName)
79 <<
"Cannot read file " << fName
86 DynamicList<label> indices;
88 DynamicList<labelledTri>
faces;
90 Map<label> groupToPatch;
93 Map<word> groupToName;
103 HashSet<word> unhandledCmd;
111 if (line.substr(0, 10) ==
"$ANSA_NAME")
120 && sem1 != string::npos
121 && sem2 != string::npos
126 IStringStream(line.substr(sem0+1, sem1-sem0-1))()
128 ansaType = line.substr(sem1+1, sem2-sem1-1);
131 is.getLine(ansaName);
132 if (ansaName[ansaName.size()-1] ==
'\r')
134 ansaName = ansaName.substr(1, ansaName.size()-2);
138 ansaName = ansaName.substr(1, ansaName.size()-1);
152 line.substr(0, 12) ==
"$HMNAME COMP"
153 && line.find (
'"') != string::npos
158 IStringStream(line.substr(16, 16))()
161 IStringStream lineStream(line.substr(32));
164 lineStream >> rawName;
166 groupToName.insert(groupId, string::validate<word>(rawName));
167 Info<<
"group " << groupId <<
" => " << rawName <<
endl;
171 if (line.empty() || line[0] ==
'$')
178 if (line.size() > 72 && line[72] ==
'+')
180 line = line.substr(0, 72);
187 if (buf.size() > 72 && buf[72]==
'+')
189 line += buf.substr(8, 64);
193 line += buf.substr(8, buf.size()-8);
200 IStringStream lineStream(line);
216 if (iter == groupToPatch.end())
219 groupToPatch.insert(groupId,
patchi);
229 else if (cmd ==
"CQUAD4")
241 if (iter == groupToPatch.end())
244 groupToPatch.insert(groupId,
patchi);
255 else if (cmd ==
"PSHELL")
259 if (groupId == ansaId && ansaType ==
"PSHELL")
261 groupToName.insert(groupId, string::validate<word>(ansaName));
262 Info<<
"group " << groupId <<
" => " << ansaName <<
endl;
265 else if (cmd ==
"GRID")
272 indices.append(index);
275 else if (cmd ==
"GRID*")
291 <<
"Expected continuation symbol '*' when reading GRID*"
292 <<
" (double precision coordinate) output" <<
nl
293 <<
"Read:" << line <<
nl
294 <<
"File:" << is.name()
295 <<
" line:" << is.lineNumber()
300 indices.append(index);
303 else if (unhandledCmd.insert(cmd))
305 Info<<
"Unhandled Nastran command " << line <<
nl
306 <<
"File:" << is.name() <<
" line:" << is.lineNumber() <<
endl;
320 Map<label> indexToPoint(2*indices.size());
323 indexToPoint.insert(indices[i], i);
329 labelledTri&
f =
faces[i];
331 f[0] = indexToPoint[
f[0]];
332 f[1] = indexToPoint[
f[1]];
333 f[2] = indexToPoint[
f[2]];
graph_traits< Graph >::vertices_size_type size_type
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
friend class const_iterator
Declare friendship with the const_iterator.
Input from memory buffer stream.
void append(const T &)
Append an element at the end of the list.
void size(const label)
Override size to be inconsistent with allocated storage.
const Field< PointType > & points() const
Return reference to global points.
triSurface()
Construct null.
const geometricSurfacePatchList & patches() const
faceList faces() const
Return the list of triangles as a faceList.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
const dimensionedScalar c
Speed of light in a vacuum.
errorManipArg< error, int > exit(error &err, const int errNo=1)
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< geometricSurfacePatch > geometricSurfacePatchList
vectorField pointField
pointField is a vectorField.
vector point
Point is a vector.
static scalar parseNASCoord(const string &s)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if successful.
label readLabel(Istream &is)