61 bool isComment =
true;
64 isComment = (
'*' == is.peek());
71 isComment = (
'*' == is.peek());
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]))
565 nread = readPoints(is);
570 <<
"Read " << nread <<
" *NODE entries" <<
nl;
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="
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();
static Foam::Map< Foam::labelList > abaqusToFoamFaceAddr_
#define checkElemType(test)
Various functions to operate on Lists.
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.
bool found(const Key &key) const
Return true if hashed entry is found in table.
void clear()
Clear all entries from table.
bool good() const noexcept
True if next operation might succeed.
Generic input stream using a standard (STL) stream.
virtual std::istream & stdStream()
Access to underlying std::istream.
int peek()
Raw, low-level peek function.
ISstream & getLine(std::string &str, char delim='\n')
Raw, low-level getline (until delimiter) into a string.
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
void resize(const label len)
Adjust allocated size of list.
A HashTable to objects of type <T> with a label key.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual bool read()
Re-read model coefficients if they have changed.
Similar to IStringStream but using an externally managed buffer for its input. This allows the input ...
iterator begin() noexcept
Return an iterator to begin traversing the UList.
void size(const label n)
Older name for setAddressableSize.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
void set(const bitSet &bitset)
Set specified bits from another bitset.
Maps a geometry to a set of cell primitives.
const faceList & modelFaces() const noexcept
Return a raw list of model faces.
reference ref() const
A reference to the entry (Error if not found)
A face is a list of labels corresponding to mesh vertices.
virtual void validate()
Validate the turbulence fields after construction.
A class for handling character strings derived from std::string.
bool starts_with(const std::string &s) const
True if string starts with the given prefix (cf. C++20)
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
string upper(const std::string &s)
Return string copy transformed with std::toupper on each character.
void inplaceRemoveSpace(std::string &s)
Eliminate whitespace inplace.
dimensionedScalar pos(const dimensionedScalar &ds)
void inplaceSubset(const BoolListType &select, ListType &input, const bool invert=false)
Inplace extract elements of the input list when select is true.
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values (not the indices) of a list.
static void skipComments(ISstream &iss)
List< label > labelList
A List of labels.
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
messageStream Info
Information stream (stdout output on master, null elsewhere)
static string getIdentifier(const word &keyword, string &inputLine)
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
Inplace reorder the elements of a list.
static bool appendCsvLabels(const std::string &line, labelUList &elemNodes, label &nodei)
static constexpr const zero Zero
Global zero (0)
messageStream InfoErr
Information stream (stderr output on master, null elsewhere)
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.