37inline Foam::label Foam::fileFormats::ABAQUSsurfaceFormat<Face>::writeShell
42 const std::string& elsetName,
46 const label
n =
f.size();
52 os <<
"*ELEMENT, TYPE=S4";
54 if (!elsetName.empty())
56 os <<
", ELSET=" << elsetName;
72 os <<
"*ELEMENT, TYPE=S3";
74 if (!elsetName.empty())
76 os <<
", ELSET=" << elsetName;
94 for (label fp1 = 1; fp1 <
f.size() - 1; ++fp1)
96 const label fp2 =
f.fcIndex(fp1);
101 << (
f[fp1] + 1) <<
','
102 << (
f[fp2] + 1) <<
nl;
138 <<
"Cannot read file " << filename <<
nl
144 ABAQUSCore::readHelper reader(
true);
146 ABAQUSCore::readHelper reader;
155 reader.purge_solids();
156 reader.compact_nodes();
157 reader.renumber_elements_1to0();
164 for (
labelList& conn : reader.connectivity_)
166 dynFaces.append(Face(std::move(conn)));
173 labelHashSet elsetUsed(reader.elsetIds_);
175 labelList newToOldZone(elsetUsed.sortedToc());
178 if (newToOldZone.empty())
180 newToOldZone.push_back(0);
183 wordList zoneNames(newToOldZone.size());
186 Map<label> oldToNewZone(
invertToMap(newToOldZone));
190 const label zonei = oldToNewZone.lookup(iter.val(), -1);
194 zoneNames[zonei] = word::validate(iter.key());
201 if (zoneNames[zonei].empty())
203 zoneNames[zonei] = surfZoneIdentifier::defaultName(zonei);
208 DynamicList<label> dynZones(std::move(reader.elsetIds_));
211 for (label& zonei : dynZones)
213 zonei = oldToNewZone.lookup(zonei, 0);
220 this->storedPoints().transfer(reader.points_);
222 this->sortFacesAndStore
231 this->addZones(zoneSizes, zoneNames);
263 const bool useFaceMap = (surf.
useFaceMap() && zones.size() > 1);
267 bool useOrigFaceIds =
277 for (
const auto&
f : faceLst)
281 useOrigFaceIds =
false;
288 OFstream
os(filename, streamOpt);
292 <<
"Cannot write file " << filename <<
nl
297 os <<
"*HEADING" <<
nl;
304 writePoints(
os, pointLst);
319 for (
const surfZone& zone : zones)
321 for (label nLocal = zone.size(); nLocal--; ++faceIndex)
324 (useFaceMap ?
faceMap[faceIndex] : faceIndex);
326 const Face&
f = faceLst[facei];
330 elemId = elemIds[facei];
333 const label
n =
f.size();
336 (prevOutput.first() !=
n || prevOutput.second() != zoneIndex);
341 prevOutput.first() =
n;
342 prevOutput.second() = zoneIndex;
345 elemId = writeShell(
os,
f, elemId, zone.name(), header);
Istream and Ostream manipulators taking arguments.
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 append(const T &val)
Copy append an element to the end of this list.
List< Key > sortedToc() const
The table of contents (the keys) in sorted order.
const T & lookup(const Key &key, const T &deflt) const
Return hashed entry if it exists, or return the given default.
Input from file stream as an ISstream, normally using std::ifstream for the actual input.
A simple container for options an IOstream can normally have.
streamFormat format() const noexcept
Get the current stream format.
@ ASCII
"ascii" (normal default)
bool good() const noexcept
True if next operation might succeed.
void push_back(const T &val)
Append an element at the end of the list.
A HashTable to objects of type <T> with a label key.
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats.
const UList< surfZone > & surfZones() const noexcept
Const access to the surface zones.
const UList< Face > & surfFaces() const noexcept
Return const access to the faces.
const labelUList & faceIds() const noexcept
Const access to the faceIds, zero-sized when unused.
const labelUList & faceMap() const noexcept
Const access to the faceMap, zero-sized when unused.
const pointField & points() const noexcept
Return const access to the points.
bool useFaceMap() const noexcept
Can/should use faceMap?
pointField & storedPoints()
Non-const access to global points.
virtual void addZones(const UList< surfZone > &, const bool cullEmpty=false)
Add surface zones.
void sortFacesAndStore(DynamicList< Face > &unsortedFaces, DynamicList< label > &zoneIds, DynamicList< label > &elemIds, bool sorted)
Sort faces by zones and store sorted faces.
bool addZonesToFaces()
Propagate zone information on face regions.
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
const T & first() const noexcept
Access the first element.
const T & second() const noexcept
Access the second element.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
bool empty() const noexcept
True if List is empty (ie, size() is zero).
void size(const label n)
Older name for setAddressableSize.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A class for handling file names.
static word defaultName(const label n=-1)
Default zone name: "zone" or "zoneN".
A surface zone on a MeshedSurface.
static word validate(const std::string &s, const bool prefix=false)
Construct validated word (no invalid characters).
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
const word & name() const noexcept
The zone name.
Base class for mesh zones.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
bool found(const ListType &input, const UnaryPredicate &pred, const label start=0)
Same as found_if.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Pair< label > labelPair
A pair of labels.
List< word > wordList
List of word.
Map< label > invertToMap(const labelUList &values)
Create inverse mapping, which is a lookup table into the given list.
List< label > labelList
A List of labels.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
List< surfZone > surfZoneList
List of surfZone.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
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.