67 else if (first() == 1)
69 vector planeNormal = cd ^ second();
70 scalar magPlaneNormal =
mag(planeNormal);
72 if (magPlaneNormal > 1
e-3)
75 second() = planeNormal/magPlaneNormal;
78 else if (first() == 2)
80 if (
mag(cd & second()) > 1
e-3)
95 else if (first() == 1)
103 else if (first() == 2)
107 else if (pc.first() == 1)
109 applyConstraint(pc.second());
111 else if (pc.first() == 2)
114 if (
mag(second() & pc.second()) <= (1.0-1
e-3))
136 else if (first() == 1)
138 return I -
sqr(second());
140 else if (first() == 2)
142 return sqr(second());
159 FixedList<vector, 3> vecs;
163 vecs[0] =
vector(1, 0, 0);
164 vecs[1] =
vector(0, 1, 0);
165 vecs[2] =
vector(0, 0, 1);
167 else if (first() == 1)
169 const vector& planeDir = second();
171 vecs[0] =
vector(1, 0, 0) - planeDir.
x()*planeDir;
173 if (
mag(vecs[0].
x()) < 1
e-3)
175 vecs[0] =
vector(0, 1, 0) - planeDir.
y()*planeDir;
178 vecs[0] /=
mag(vecs[0]);
179 vecs[1] = vecs[0] ^ planeDir;
180 vecs[1] /=
mag(vecs[1]);
182 else if (first() == 2)
188 for (
direction dir =
n; dir < vecs.size(); dir++)
193 tt =
tensor(vecs[0], vecs[1], vecs[2]);
208 else if (first() == 1)
211 cd = d-(d&second())*second();
213 else if (first() == 2)
216 cd = (d&second())*second();
226 inline void Foam::combineConstraintsEqOp::operator()
229 const pointConstraint&
y 239 const pointConstraint& v
242 return pointConstraint
244 Tuple2<label, vector>(v.first(),
transform(tt, v.second()))
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
void unconstrainedDirections(label &n, tensor &vecs) const
Return the accumulated unconstrained directions. Directions.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
const Cmpt & y() const noexcept
Access to the vector y component.
void combine(const pointConstraint &)
Combine constraints.
void applyConstraint(const vector &cd)
Apply and accumulate the effect of the given constraint direction.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
const dimensionedScalar e
Elementary charge.
static const Identity< scalar > I
Accumulates point constraints through successive applications of the applyConstraint function...
refinementData transform(const tensor &, const refinementData val)
No-op rotational transform for base types.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
const Cmpt & x() const noexcept
Access to the vector x component.
tensor constraintTransformation() const
Return the accumulated constraint transformation tensor.
vector constrainDisplacement(const vector &disp) const
Constrain a displacement.
Tensor of scalars, i.e. Tensor<scalar>.
pointConstraint()
Construct null.
static constexpr const zero Zero
Global zero (0)