41 { inputFormatType::PLAIN,
"plain" },
42 { inputFormatType::DICTIONARY,
"dictionary" },
57 const char comment =
'#'
65 while ((line.empty() || line[0] == comment) && is.
good());
74void Foam::lumpedPointState::calcRotations()
const
78 auto rotIter = rotationPtr_->begin();
90void Foam::lumpedPointState::readDict
92 const dictionary&
dict,
109 rotationPtr_.reset(
nullptr);
121 rotationPtr_(nullptr)
127 points_(rhs.points_),
128 angles_(rhs.angles_),
130 degrees_(rhs.degrees_),
131 rotationPtr_(nullptr)
147 rotationPtr_(nullptr)
149 if (points_.
size() != angles_.
size())
153 <<
"Have " << points_.
size() <<
" points but "
154 << angles_.
size() <<
" angles" <<
nl
158 <<
"Have " << points_.
size() <<
" points but "
159 << angles_.
size() <<
" angles, resizing angles to match" <<
nl;
175 angles_(points_.size(),
Zero),
178 rotationPtr_(nullptr)
190 angles_(points_.size(),
Zero),
193 rotationPtr_(nullptr)
208 rotationPtr_(nullptr)
218 points_ = rhs.points_;
219 angles_ = rhs.angles_;
221 degrees_ = rhs.degrees_;
223 rotationPtr_.reset(
nullptr);
240 points_ *= scaleFactor;
251 points_ = prev.points_ +
alpha*(points_ - prev.points_);
253 scalar convert = 1.0;
254 if (degrees_ != prev.degrees_)
268 angles_ = convert*prev.angles_ +
alpha*(angles_ - convert*prev.angles_);
270 rotationPtr_.reset(
nullptr);
284 string line = getLineNoComment(iss);
292 points_.resize(count);
293 angles_.resize(count);
302 >> points_[count].x() >> points_[count].y() >> points_[count].z()
303 >> angles_[count].x() >> angles_[count].y() >> angles_[count].z();
308 points_.resize(count);
309 angles_.resize(count);
313 rotationPtr_.reset(
nullptr);
327 readDict(
dict, rotOrder, degrees);
329 return points_.size();
357 os <<
"# input for OpenFOAM\n"
358 <<
"# N, points, angles\n"
359 << points_.size() <<
"\n";
365 os <<
p.x() <<
' ' <<
p.y() <<
' ' <<
p.z();
367 if (i < angles_.size())
369 os <<
' ' << angles_[i].x()
370 <<
' ' << angles_[i].y()
371 <<
' ' << angles_[i].z() <<
'\n';
394 if (fmt == inputFormatType::PLAIN)
396 ok = this->readPlain(is, rotOrder, degrees);
400 ok = this->readData(is, rotOrder, degrees);
417 rotationPtr_.reset(
nullptr);
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
EnumType getOrDefault(const word &key, const dictionary &dict, const EnumType deflt, const bool failsafe=false) const
Input from file stream, using an ISstream.
bool good() const noexcept
True if next operation might succeed.
Generic input stream using a standard (STL) stream.
ISstream & getLine(std::string &str, char delim='\n')
Raw, low-level getline (until delimiter) into a string.
Input from string buffer, using a ISstream. Always UNCOMPRESSED.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void resize(const label len)
Adjust allocated size of list.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
static void broadcasts(const label comm, Type &arg1, Args &&... args)
Broadcast multiple items to all processes in communicator.
void size(const label n)
Older name for setAddressableSize.
static label worldComm
Default communicator (all processors)
static bool & parRun() noexcept
Test if this a parallel run.
virtual const coordinateRotation & rotation() const
The rotation specification.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
void relax()
Relax matrix (for steady-state solution).
A class for handling file names.
Foam::dictionary writeDict() const
Write to dictionary.
The state of lumped points corresponds to positions and rotations.
lumpedPointState()
Default construct.
void writePlain(Ostream &os) const
Output as plain content.
inputFormatType
Input format types.
bool degrees() const
Rotation angles in degrees.
bool writeData(Ostream &os) const
Output as dictionary content.
static bool visUnused
Enable/disable visualization of unused points.
static scalar visLength
The length for visualization triangles.
static const Enum< inputFormatType > formatNames
Names for the input format types.
bool readData(Istream &is, const quaternion::eulerOrder rotOrder=quaternion::eulerOrder::ZXZ, const bool degrees=false)
Read input as dictionary content.
void operator=(const lumpedPointState &rhs)
Assignment operator.
bool readPlain(Istream &is, const quaternion::eulerOrder rotOrder=quaternion::eulerOrder::ZXZ, const bool degrees=false)
Read input as plain content.
void operator+=(const point &origin)
Shift points by specified origin.
void scalePoints(const scalar scaleFactor)
Scale points by given factor.
const vectorField & angles() const
The orientation of the points (mass centres)
Quaternion class used to perform rotations in 3D space.
static const Enum< eulerOrder > eulerOrderNames
eulerOrder
Euler-angle rotation order.
splitCell * master() const
A class for handling character strings derived from std::string.
A class for managing temporary objects.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
#define WarningInFunction
Report a warning using Foam::Warning.
constexpr scalar degToRad() noexcept
Multiplication factor for degrees to radians conversion.
constexpr scalar radToDeg() noexcept
Multiplication factor for radians to degrees conversion.
static constexpr const zero Zero
Global zero (0)
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
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.
Unit conversion functions.