Go to the documentation of this file.
73 Info<<
"Using response table with " << tbl.size() <<
" entries" <<
nl;
77 Info<<
"Increment input by " << span <<
nl;
82 Info<<
"Stopping after " << maxOut <<
" outputs" <<
nl;
89 int main(
int argc,
char *argv[])
93 "Visualize lumpedPoint movements or provide a slave responder"
94 " for diagnostic purposes."
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)"
125 "Test movement without a mesh"
130 "Remove lock-file on termination of slave"
135 "Invoke as a slave responder for testing"
145 const bool dryrun =
args.
found(
"dry-run");
147 const bool removeLock =
args.
found(
"removeLock");
161 Info<<
"Running as slave responder" <<
endl;
166 <<
"Running as slave responder is not permitted in parallel"
179 Info<<
"No valid movement found" <<
endl;
182 auto& movement = *movementPtr;
188 getResponseTable(responseFile, state0);
190 echoTableLimits(responseTable, span, maxOut);
194 Info<<
"dry-run: response table with " << responseTable.size()
196 <<
"\nEnd\n" <<
endl;
204 label timei = 0, outputCount = 0;
205 timei < responseTable.size();
215 <<
": stopping status=done was detected" <<
endl;
226 movement.inputFormat()
234 os.writeEntry(
"time", responseTable[timei].first());
239 <<
": updated to state " << timei
240 <<
" - switch to master"
248 if (maxOut && outputCount >= maxOut)
251 <<
": stopping after " << maxOut <<
" outputs" <<
endl;
275 Info<<
"dry-run: creating states only" <<
nl;
285 Info<<
"No valid movement found" <<
endl;
288 auto& movement = *movementPtr;
294 getResponseTable(responseFile, state0);
296 echoTableLimits(responseTable, span, maxOut);
303 label timei = 0, outputCount = 0;
304 timei < responseTable.size();
310 state += movement.origin();
314 Info<<
"output [" << timei <<
'/' << responseTable.size() <<
']';
318 const word outputName =
321 Info<<
" " << outputName;
323 movement.writeStateVTP(state, outputName);
324 stateSeries.
append(outputCount, outputName);
331 if (maxOut && outputCount >= maxOut)
333 Info<<
"Max output " << maxOut <<
" ... stopping" <<
endl;
340 if (stateSeries.
size())
342 Info<<
nl <<
"write state.vtp.series" <<
nl;
343 stateSeries.
write(
"state.vtp");
367 Info<<
"No valid movement found" <<
endl;
370 auto& movement = *movementPtr;
376 getResponseTable(responseFile, state0);
378 echoTableLimits(responseTable, span, maxOut);
385 Info<<
"No point patches with lumped movement found" <<
endl;
389 Info<<
"Lumped point patch controls set on "
400 movement.writeVTP(
"geom_init.vtp", state0,
mesh,
points0);
406 label timei = 0, outputCount = 0;
407 timei < responseTable.size();
413 state += movement.origin();
417 Info<<
"output [" << timei <<
'/' << responseTable.size() <<
']';
421 const word outputName =
424 Info<<
" " << outputName;
426 movement.writeStateVTP(state, outputName);
427 stateSeries.
append(outputCount, outputName);
431 const word outputName =
434 Info<<
" " << outputName;
436 movement.writeVTP(outputName, state,
mesh,
points0);
437 geomSeries.
append(outputCount, outputName);
444 if (maxOut && outputCount >= maxOut)
446 Info<<
"Max output " << maxOut <<
" ... stopping" <<
endl;
454 if (geomSeries.
size())
456 Info<<
nl <<
"write geom.vtp.series" <<
nl;
457 geomSeries.
write(
"geom.vtp");
459 if (stateSeries.
size())
461 Info<<
nl <<
"write state.vtp.series" <<
nl;
462 stateSeries.
write(
"state.vtp");
A class for handling words, derived from Foam::string.
void writeDict(Ostream &os) const
Output as dictionary content.
A class for handling file names.
A primitive field of type <T> with automated input and output.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
static bool & parRun()
Is this a parallel run?
void relax(const scalar alpha, const lumpedPointState &prev)
Relax the state.
enum Time::stopAtControls useMaster(const bool wait=false) const
Create lock file to indicate that OpenFOAM is in charge.
static void addNote(const string ¬e)
Add extra notes for the usage information.
Ostream & endl(Ostream &os)
Add newline and flush stream.
enum Time::stopAtControls waitForMaster() const
Wait for master to complete.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
"plain" is a simple ASCII format
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
The state of lumped points corresponds to positions and rotations.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
void scalePoints(const scalar scaleFactor)
Scale points by given factor.
const word & executable() const
Name of executable without the path.
messageStream Info
Information stream (uses stdout - output is on the master only)
void writePlain(Ostream &os) const
Output as plain content.
quaternion::eulerOrder rotationOrder() const
The Euler-angle rotation order.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
fileName resolveFile(const word &file) const
Return the file path in the communications directory.
Provides a means of accumulating and generating VTK file series.
static void write(const fileName &base, const UList< instant > &series, const char sep='_')
Write file series (JSON format) to disk, for specified instances.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Output to file stream, using an OSstream.
enum Time::stopAtControls useSlave(const bool wait=false) const
Remove lock file to indicate that the external program is in charge.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
pointField points0(pointIOField(IOobject("points", mesh.time().constant(), polyMesh::meshSubDir, mesh, IOobject::MUST_READ, IOobject::NO_WRITE, false)))
Encapsulates the logic for coordinating between OpenFOAM and an external application.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label size() const noexcept
The number of data sets.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
virtual void setTime(const Time &t)
Reset the time and time-index to those of the given time.
static word printf(const char *fmt, const PrimitiveType &val)
Use a printf-style formatter for a primitive.
bool append(const fileNameInstant &inst)
Append the specified file instant.
An instant of time. Contains the time value and name.
const word & constant() const
Return constant name.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
Foam::argList args(argc, argv)
bool degrees() const
Rotation angles in degrees.
static scalar visLength
The length for visualization triangles.
static autoPtr< lumpedPointIOMovement > New(const objectRegistry &obr, label ownerId=-1)
bool found(const word &optName) const
Return true if the named option is found.