50Foam::coordSetWriters::abaqusWriter::timeBaseNames_
52 { timeBase::time,
"time" },
53 { timeBase::iter,
"iteration" },
64 if (width)
os <<
setw(width);
72Foam::string Foam::coordSetWriters::abaqusWriter::replaceUserEntries
80 const bool allowEnv =
true;
81 const bool allowEmpty =
false;
89void Foam::coordSetWriters::abaqusWriter::appendTimeName
91 const word& fieldName,
109 fName.ext(
Foam::name(writeIndex_[fieldName]));
115 <<
"Unhandled enumeration " << timeBaseNames_[timeBase_]
116 <<
". Available options: " << timeBaseNames_.sortedToc()
129 writeGeometry_(false),
141 writeGeometry_(false),
144 timeBase_(timeBase::time),
151 if (!useLocalTimeDir_)
153 timeBaseNames_.
readIfPresent(
"timeBase", options, timeBase_);
172 open(coords, outputPath);
185 open(tracks, outputPath);
204 return getExpectedPath(
"inp");
208void Foam::coordSetWriters::abaqusWriter::writeGeometry
214 if (!writeGeometry_ || coords_.empty())
219 os <<
"** Geometry" <<
nl
225 label globalPointi = 1;
226 for (
const coordSet& coords : coords_)
228 for (
const point&
p : coords)
230 const point tp =
p*geometryScale_;
232 os << globalPointi <<
", "
233 << tp[0] <<
", " << tp[1] <<
", " << tp[2] <<
nl;
252 const word& fieldName,
257 useTimeDir(useLocalTimeDir_);
267 fileName outputFile =
path();
271 if (!writeIndex_.insert(fieldName, 0))
273 ++writeIndex_[fieldName];
276 if (!
isDir(outputFile.path()))
278 mkDir(outputFile.path());
283 const word geomName(
"geometry");
284 if (!writeIndex_.insert(geomName, 0))
286 ++writeIndex_[geomName];
289 fileName geomFileName(outputFile.lessExt() +
".inp");
291 appendTimeName(
"geometry", geomFileName);
295 Info<<
"Writing abaqus geometry to " << geomFileName <<
endl;
298 OFstream osGeom(geomFileName);
303 fileName fieldFileName(outputFile.lessExt() +
".inp_" + fieldName);
304 appendTimeName(fieldName, fieldFileName);
308 Info<<
"Writing field data to " << fieldFileName <<
endl;
311 OFstream
os(fieldFileName);
313 if (!outputHeader_.empty())
317 vars.add(
"FIELD_NAME", fieldName);
318 vars.add(
"FILE_NAME", fieldFileName);
320 for (
const auto&
s : outputHeader_)
322 os << replaceUserEntries(
s, vars).c_str() <<
nl;
327 os <<
"** OpenFOAM " << fieldFileName.nameLessExt() <<
nl
328 <<
"** Project " << outputFile <<
nl
329 <<
"** Field=" << fieldName <<
" Time=" <<
timeName() <<
nl;
332 tmp<Field<Type>> tfield(values);
333 tfield = adjustFieldTemplate(fieldName, tfield);
334 const auto&
field = tfield();
339 for (
direction cmpt=0; cmpt<pTraits<Type>::nComponents; ++cmpt)
344 if (
s > 0.5*pTraits<scalar>::max)
362 const word& fieldName,
374 fileName outputFile =
path();
380 Info<<
"Writing abaqus geometry to " << outputFile <<
endl;
383 if (!
isDir(outputFile.path()))
385 mkDir(outputFile.path());
388 OFstream osGeom(outputFile.lessExt() +
"." + fieldName +
".inp");
391 <<
"** Geometry" <<
nl
Istream and Ostream manipulators taking arguments.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
bool readIfPresent(const word &key, const dictionary &dict, EnumType &val, const bool warnOnly=false) const
Find an entry if present, and assign to T val.
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Base class for writing coordSet(s) and tracks with fields.
virtual void open(const fileName &outputPath)
Write separate geometry to file.
fileName getExpectedPath(const word &fileExt=word::null) const
Get expected (characteristic) output file name - information only.
bool wroteGeom_
Track if geometry has been written since the last open.
bool useTimeDir() const noexcept
Should a time directory be spliced into the output path?
void checkOpen() const
Verify that the outputPath_ has been set or FatalError.
coordSetWriter(const coordSetWriter &)=delete
No copy construct.
bool useTracks_
Prefer tracks to points during single set writing.
bool verbose_
Additional output verbosity.
tmp< Field< Type > > adjustFieldTemplate(const word &fieldName, const tmp< Field< Type > > &tfield) const
UPtrList< const coordSet > coords_
Reference to coordinate set(s).
virtual void close(bool force=false)
Finish output, performing any necessary cleanup.
Write coordSet(s) as Abaqus point fields.
abaqusWriter()
Default construct.
virtual ~abaqusWriter()
Destructor. Calls close().
timeBase
Enumeration for time base.
virtual fileName path() const
Characteristic output file name - information only.
Holds list of sampling positions.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
A class for handling file names.
static std::string nameLessExt(const std::string &s)
Same as stem().
fileName lessExt() const
Return file name without extension (part before last .).
static const fileName null
An empty fileName.
static std::string path(const std::string &str)
Return directory path name (part before last /).
A traits class, which is primarily used for primitives and vector-space.
A class for handling character strings derived from std::string.
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
#define defineTypeName(Type)
Define the typeName.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
Convenience macros for instantiating coordSetWriter methods.
#define defineCoordSetWriterWriteFields(ThisClass)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
#define WarningInFunction
Report a warning using Foam::Warning.
void inplaceExpand(std::string &s, const HashTable< string > &mapping, const char sigil='$')
Inplace expand occurrences of variables according to the mapping. Does not use environment values.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
messageStream Info
Information stream (stdout output on master, null elsewhere).
Omanip< int > setw(const int i)
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
vector point
Point is a vector.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
static void putValue(Ostream &os, const Type &value, const int width)
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.