Go to the documentation of this file.
61 bool isComment =
true;
64 isComment = (
'*' == is.
peek());
71 isComment = (
'*' == is.
peek());
97 static string getIdentifier(
const word& keyword,
string& inputLine)
114 auto beg = line.find(
"," +
key +
"=");
116 if (beg != std::string::npos)
119 beg +=
key.size() + 2;
122 auto len = line.find(
',', beg);
123 if (len != std::string::npos)
129 return inputLine.substr(beg, len);
145 const std::string&
line,
150 const label nNodes = elemNodes.
size();
154 while (nodei < nNodes &&
pos != std::string::npos)
157 auto len =
line.find(
',',
pos);
159 if (len == std::string::npos)
180 return (nodei >= nNodes);
208 #define checkElemType(test) (elemTypeName.find(test) != std::string::npos)
217 return shapeType::abaqusTria;
227 return shapeType::abaqusQuad;
234 return shapeType::abaqusTet;
241 return shapeType::abaqusPyr;
248 return shapeType::abaqusPrism;
255 return shapeType::abaqusHex;
260 return shapeType::abaqusUnknownShape;
269 const std::string& setName
272 if (elsetMap_.empty())
285 label setId = elsetMap_.lookup(setName, -1);
300 if (needle == haystack)
307 setId = elsetMap_.size();
308 elsetMap_.set(setName, setId);
320 const label initialCount = points_.size();
328 while (is.
peek() !=
'*' && is.
peek() != EOF)
341 ss >>
id >> sep >>
p.x() >> sep >>
p.y() >> sep >>
p.z();
347 return (points_.size() - initialCount);
368 const label initialCount = elemTypes_.size();
379 while (is.
peek() !=
'*' && is.
peek() != EOF)
386 while (nodei < nNodes)
396 connectivity_.append(elemNodes);
397 elemTypes_.append(shape);
399 elsetIds_.append(setId);
402 return (elemTypes_.size() - initialCount);
421 const auto& abqToFoamFaceMap = abaqusToFoamFaceAddr();
423 const label initialCount = elemTypes_.size();
433 while (is.
peek() !=
'*' && is.
peek() != EOF)
443 || sideName[0] !=
'S'
444 || !std::isdigit(sideName[1])
447 Info<<
"Abaqus reader: unsupported surface element side "
448 <<
id <<
", " << sideName <<
nl;
452 const label index = elemIds_.find(
id);
453 if (
id <= 0 || index < 0)
455 Info<<
"Abaqus reader: unsupported surface element "
460 const auto faceIdIter = abqToFoamFaceMap.cfind(elemTypes_[index]);
461 if (!faceIdIter.found())
463 Info<<
"Abaqus reader: reject non-solid shape: " <<
nl;
467 const label sideNum = (sideName[1] -
'0');
469 const label foamFaceNum = (*faceIdIter)[sideNum - 1];
471 const labelList& connect = connectivity_[index];
476 switch (elemTypes_[index])
478 case shapeType::abaqusTet:
483 case shapeType::abaqusPrism:
488 case shapeType::abaqusHex:
490 elemNodes =
labelList(connect,
hex.modelFaces()[foamFaceNum]);
497 enum shapeType shape = shapeType::abaqusUnknownShape;
499 if (elemNodes.size() == 3)
501 shape = shapeType::abaqusTria;
503 else if (elemNodes.size() == 4)
505 shape = shapeType::abaqusQuad;
511 <<
"Could not map face side for "
512 <<
id <<
", " << sideName <<
nl
520 connectivity_.append(std::move(elemNodes));
521 elemTypes_.append(shape);
522 elemIds_.append(newElemId);
523 elsetIds_.append(setId);
526 return (elemTypes_.size() - initialCount);
546 if (
line[0] !=
'*' || !std::isalpha(
line[1]))
559 if (upperLine.starts_with(
"*NODE"))
565 nread = readPoints(is);
570 <<
"Read " << nread <<
" *NODE entries" <<
nl;
578 if (upperLine.starts_with(
"*ELEMENT,"))
586 const shapeType shape(getElementType(elemTypeName));
594 <<
"Ignore abaqus element type: "
595 << elemTypeName <<
nl;
600 const label elsetId = addNewElset(elsetName);
604 nread = readElements(is, shape, elsetId);
609 <<
"Read " << nread <<
" *ELEMENT entries ("
610 << elemTypeName <<
") elset="
619 if (upperLine.starts_with(
"*SURFACE,"))
630 !surfTypeName.empty()
634 Info<<
"Reading abaqus surface type "
635 << surfTypeName <<
" is not implemented" <<
nl;
640 const label elsetId = addNewElset(elsetName);
644 nread = readSurfaceElements(is, elsetId);
649 <<
"Read " << nread <<
" *SURFACE entries for "
661 bitSet select(elemTypes_.size(),
false);
665 if (!isValidType(elemTypes_[i]) || isSolidType(elemTypes_[i]))
686 if (!nodeIds_.empty())
709 for (
const labelList& elem : connectivity_)
711 for (
const label origId : elem)
713 nodeIdRemapping(origId) = 0;
720 labelList oldToNewLocal(nodeIds_.size(), -1);
724 const label origId = nodeIds_[i];
726 if (nodeIdRemapping.found(origId))
729 nodeIdRemapping(origId) =
nPoints;
741 for (label&
id : elem)
743 id = nodeIdRemapping[id];
755 bitSet usedNodeIds(points_.size());
757 for (
const labelList& elem : connectivity_)
759 usedNodeIds.set(elem);
780 for (label& elemId : elemIds_)
782 renumber0_elemId(elemId);
791 const scalar scaleFactor
803 os.setf(std::ios::showpoint);
813 << (scaleFactor *
p.x()) <<
','
814 << (scaleFactor *
p.y()) <<
','
815 << (scaleFactor *
p.z()) <<
nl;
835 auto offsetIter = decompOffsets.begin();
838 for (
const face&
f : faces)
840 const label
n =
f.size();
842 if (
n != 3 &&
n != 4)
845 f.triangles(
points, decompFaces);
849 *(++offsetIter) = decompFaces.size();
852 return decompFaces.size();
List< label > labelList
A List of labels.
Similar to IStringStream but using an externally managed buffer for its input. This allows the input ...
A class for handling words, derived from Foam::string.
ISstream & getLine(std::string &str, char delim='\n')
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
void resize(const label len)
static constexpr const zero Zero
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
bool starts_with(const std::string &s) const
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
Generic input stream using a standard (STL) stream.
void set(const bitSet &bitset)
A HashTable to objects of type <T> with a label key.
static word validate(const std::string &s, const bool prefix=false)
A class for handling character strings derived from std::string.
labelList invert(const label len, const labelUList &map)
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
bool good() const noexcept
static string getIdentifier(const word &keyword, string &inputLine)
static Foam::Map< Foam::labelList > abaqusToFoamFaceAddr_
static const cellModel & ref(const modelType model)
#define checkElemType(test)
OBJstream os(runTime.globalPath()/outputName)
void inplaceSubset(const BoolListType &select, ListType &input, const bool invert=false)
errorManipArg< error, int > exit(error &err, const int errNo=1)
IOstream & hex(IOstream &io)
virtual std::istream & stdStream()
#define FatalErrorInFunction
forAllConstIters(mixture.phases(), phase)
void inplaceRemoveSpace(std::string &s)
label readLabel(const char *buf)
static bool appendCsvLabels(const std::string &line, labelUList &elemNodes, label &nodei)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
const faceList & modelFaces() const noexcept
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
A face is a list of labels corresponding to mesh vertices.
Various functions to operate on Lists.
Maps a geometry to a set of cell primitives.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
vector point
Point is a vector.
string upper(const std::string &s)
static void skipComments(ISstream &iss)
dimensionedScalar pos(const dimensionedScalar &ds)