Go to the documentation of this file.
42 { inputFormatType::PLAIN,
"plain" },
43 { inputFormatType::DICTIONARY,
"dictionary" },
53 const char comment =
'#'
61 while ((line.empty() || line[0] == comment) && is.
good());
70 void Foam::lumpedPointState::calcRotations()
const
74 auto rotIter = rotationPtr_->begin();
86 void Foam::lumpedPointState::readDict(
const dictionary&
dict)
95 quaternion::eulerOrder::ZXZ
111 rotationPtr_(nullptr)
117 points_(rhs.points_),
118 angles_(rhs.angles_),
120 degrees_(rhs.degrees_),
121 rotationPtr_(nullptr)
128 angles_(points_.size(),
Zero),
131 rotationPtr_(nullptr)
138 angles_(points_.size(),
Zero),
141 rotationPtr_(nullptr)
151 rotationPtr_(nullptr)
169 points_ = rhs.points_;
170 angles_ = rhs.angles_;
172 degrees_ = rhs.degrees_;
182 points_ *= scaleFactor;
193 points_ = prev.points_ +
alpha*(points_ - prev.points_);
195 scalar convert = 1.0;
196 if (degrees_ != prev.degrees_)
210 angles_ = convert*prev.angles_ +
alpha*(angles_ - convert*prev.angles_);
221 string line = getLineNoComment(iss);
229 points_.setSize(
count);
230 angles_.setSize(
count);
245 points_.setSize(
count);
246 angles_.setSize(
count);
247 order_ = quaternion::eulerOrder::ZXZ;
261 return points_.size();
276 if (order_ != quaternion::eulerOrder::ZXZ)
289 os <<
"# input for OpenFOAM\n"
290 <<
"# N, points, angles\n"
291 << points_.size() <<
"\n";
295 const vector& pt = points_[i];
297 os << pt.
x() <<
' ' << pt.
y() <<
' ' << pt.
z();
299 if (i < angles_.size())
301 os <<
' ' << angles_[i].x()
302 <<
' ' << angles_[i].y()
303 <<
' ' << angles_[i].z() <<
'\n';
324 if (fmt == inputFormatType::PLAIN)
326 ok = this->readPlain(is);
330 ok = this->readData(is);
349 if (myComm.
above() != -1)
360 fromAbove >> points_ >> angles_ >> degrees_;
369 myComm.
below()[belowI],
375 toBelow << points_ << angles_ << degrees_;
const Cmpt & x() const
Access to the vector x component.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
void writeDict(Ostream &os) const
Output as dictionary content.
ISstream & getLine(std::string &str, char delim='\n')
Raw, low-level getline into a string function.
A class for handling file names.
A class for managing temporary objects.
static constexpr const zero Zero
Global zero.
Input from file stream, using an ISstream.
inputFormatType
Input format types.
Output inter-processor communications stream.
void operator=(const lumpedPointState &rhs)
Assignment operator.
Template functions to aid in the implementation of demand driven data.
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static bool & parRun()
Is this a parallel run?
void relax(const scalar alpha, const lumpedPointState &prev)
Relax the state.
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
Generic input stream using standard (STL) streams.
virtual ~lumpedPointState()
Destructor.
Unit conversion functions.
static void scatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Distribute without modification. Reverse of gather.
A class for handling character strings derived from std::string.
T lookupOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
const Cmpt & z() const
Access to the vector z component.
#define forAll(list, i)
Loop across all elements in list.
Quaternion class used to perform rotations in 3D space.
void deleteDemandDrivenData(DataPtr &dataPtr)
The state of lumped points corresponds to positions and rotations.
void scalePoints(const scalar scaleFactor)
Scale points by given factor.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static const Enum< inputFormatType > formatNames
Names for the input format types.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
const vectorField & angles() const
The orientation of the points (mass centres)
EnumType getOrDefault(const word &key, const dictionary &dict, const EnumType deflt, const bool failsafe=false) const
void writePlain(Ostream &os) const
Output as plain content.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
constexpr scalar radToDeg(const scalar rad) noexcept
Conversion from radians to degrees.
bool readData(Istream &is)
Read input as dictionary content.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
bool writeData(Ostream &os) const
Output as dictionary content.
Input from string buffer, using a ISstream.
Vector< scalar > vector
A scalar version of the templated Vector.
constexpr scalar degToRad(const scalar deg) noexcept
Conversion from degrees to radians.
Structure for communicating between processors.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
static bool master(const label communicator=0)
Am I the master process.
static int nProcsSimpleSum
const Cmpt & y() const
Access to the vector y component.
static const Enum< eulerOrder > eulerOrderNames
The names for Euler-angle rotation order.
static int & msgType()
Message tag of standard messages.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
static label worldComm
Default communicator (all processors)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
Input inter-processor communications stream.
static tensor rotation(const vector &angles, bool degrees=false)
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
lumpedPointState()
Construct null.
static const List< commsStruct > & linearCommunication(const label communicator=0)
Communication schedule for linear all-to-master (proc 0)
bool good() const
Return true if next operation might succeed.
bool readPlain(Istream &is)
Read input as plain content.
const labelList & below() const
static const List< commsStruct > & treeCommunication(const label communicator=0)
Communication schedule for tree all-to-master (proc 0)