57 return lumpedPointTools::lumpedPointStates
73 Info<<
"Using response table with " << tbl.
size() <<
" entries" <<
nl;
77 Info<<
"Increment input by " << span <<
nl;
82 Info<<
"Stopping after " << maxOut <<
" outputs" <<
nl;
89int main(
int argc,
char *argv[])
93 "Visualize lumpedPoint movements or provide a slave responder"
94 " for diagnostic purposes."
97 argList::noFunctionObjects();
102 "Maximum number of outputs"
108 "Increment each input by N (default: 1)"
114 "Relaxation/scaling factor for movement (default: 1)"
120 "Visualization length for planes (visualized as triangles)"
122 argList::addDryRunOption
124 "Test movement without a mesh"
126 argList::addBoolOption
129 "Remove lock-file on termination of slave"
131 argList::addBoolOption
134 "Invoke as a slave responder for testing"
136 argList::addArgument(
"responseFile");
146 const bool removeLock =
args.
found(
"removeLock");
160 Info<<
"Running as slave responder" <<
endl;
162 if (Pstream::parRun())
165 <<
"Running as slave responder is not permitted in parallel"
174 lumpedPointIOMovement::New(
runTime);
178 Info<<
"No valid movement found" <<
endl;
181 auto& movement = *movementPtr;
187 getResponseTable(responseFile, state0);
189 echoTableLimits(responseTable, span, maxOut);
193 Info<<
"dry-run: response table with " << responseTable.
size()
195 <<
"\nEnd\n" <<
endl;
203 label timei = 0, outputCount = 0;
204 timei < responseTable.
size();
214 <<
": stopping status=done was detected" <<
endl;
225 movement.inputFormat()
226 == lumpedPointState::inputFormatType::PLAIN
233 os.writeEntry(
"time", responseTable[timei].first());
238 <<
": updated to state " << timei
239 <<
" - switch to master"
247 if (maxOut && outputCount >= maxOut)
250 <<
": stopping after " << maxOut <<
" outputs" <<
endl;
274 Info<<
"dry-run: creating states only" <<
nl;
280 lumpedPointIOMovement::New(
runTime);
284 Info<<
"No valid movement found" <<
endl;
287 auto& movement = *movementPtr;
293 getResponseTable(responseFile, state0);
295 echoTableLimits(responseTable, span, maxOut);
302 label timei = 0, outputCount = 0;
303 timei < responseTable.
size();
309 state += movement.origin();
313 Info<<
"output [" << timei <<
'/' << responseTable.
size() <<
']';
318 word::printf(
"state_%06d.vtp", outputCount);
330 if (maxOut && outputCount >= maxOut)
332 Info<<
"Max output " << maxOut <<
" ... stopping" <<
endl;
339 if (stateSeries.
size())
341 Info<<
nl <<
"write state.vtp.series" <<
nl;
342 stateSeries.
write(
"state.vtp");
362 lumpedPointIOMovement::New(
mesh);
366 Info<<
"No valid movement found" <<
endl;
369 auto& movement = *movementPtr;
375 getResponseTable(responseFile, state0);
377 echoTableLimits(responseTable, span, maxOut);
384 Info<<
"No point patches with lumped movement found" <<
endl;
388 Info<<
"Lumped point patch controls set on "
399 movement.writeVTP(
"geom_init.vtp", state0,
mesh,
points0);
401 lumpedPointTools::setInterpolators(
mesh);
405 label timei = 0, outputCount = 0;
406 timei < responseTable.
size();
412 state += movement.origin();
416 Info<<
"output [" << timei <<
'/' << responseTable.
size() <<
']';
421 word::printf(
"state_%06d.vtp", outputCount);
431 word::printf(
"geom_%06d.vtp", outputCount);
443 if (maxOut && outputCount >= maxOut)
445 Info<<
"Max output " << maxOut <<
" ... stopping" <<
endl;
453 if (geomSeries.
size())
455 Info<<
nl <<
"write geom.vtp.series" <<
nl;
456 geomSeries.
write(
"geom.vtp");
458 if (stateSeries.
size())
460 Info<<
nl <<
"write state.vtp.series" <<
nl;
461 stateSeries.
write(
"state.vtp");
A primitive field of type <T> with automated input and output.
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, using an OSstream.
void size(const label n)
Older name for setAddressableSize.
T get(const label index) const
Get a value from the argument at index.
int dryRun() const noexcept
Return the dry-run flag.
bool found(const word &optName) const
Return true if the named option is found.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
const word & executable() const noexcept
Name of executable without the path.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Encapsulates the logic for coordinating between OpenFOAM and an external application.
enum Time::stopAtControls useSlave(const bool wait=false) const
Remove lock file to indicate that the external program is in charge.
enum Time::stopAtControls useMaster(const bool wait=false) const
Create lock file to indicate that OpenFOAM is in charge.
fileName resolveFile(const word &file) const
Return the file path in the communications directory.
enum Time::stopAtControls waitForMaster() const
Wait for master to complete.
A class for handling file names.
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name.
The state of lumped points corresponds to positions and rotations.
void writePlain(Ostream &os) const
Output as plain content.
bool degrees() const
Rotation angles in degrees.
void relax(const scalar alpha, const lumpedPointState &prev)
Relax the state.
quaternion::eulerOrder rotationOrder() const
The Euler-angle rotation order.
void writeDict(Ostream &os) const
Output as dictionary content.
void scalePoints(const scalar scaleFactor)
Scale points by given factor.
Provides a means of accumulating and generating VTK file series.
bool append(const fileNameInstant &inst)
Append the specified file instant.
label size() const noexcept
The number of data sets.
static void write(const fileName &base, const UList< instant > &series, const char sep='_')
Write file series (JSON format) to disk, for specified instances.
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
word outputName("finiteArea-edges.obj")
OBJstream os(runTime.globalPath()/outputName)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
Foam::argList args(argc, argv)
pointField points0(pointIOField(IOobject("points", mesh.time().constant(), polyMesh::meshSubDir, mesh, IOobject::MUST_READ, IOobject::NO_WRITE, false)))