57 else if (first() == 1)
59 vector planeNormal = cd ^ second();
60 scalar magPlaneNormal =
mag(planeNormal);
62 if (magPlaneNormal > 1
e-3)
65 second() = planeNormal/magPlaneNormal;
68 else if (first() == 2)
70 if (
mag(cd & second()) > 1
e-3)
85 else if (first() == 1)
93 else if (first() == 2)
97 else if (pc.first() == 1)
99 applyConstraint(pc.second());
101 else if (pc.first() == 2)
104 if (
mag(second() & pc.second()) <= (1.0-1
e-3))
126 else if (first() == 1)
128 return I -
sqr(second());
130 else if (first() == 2)
132 return sqr(second());
149 FixedList<vector, 3> vecs;
153 vecs[0] =
vector(1, 0, 0);
154 vecs[1] =
vector(0, 1, 0);
155 vecs[2] =
vector(0, 0, 1);
157 else if (first() == 1)
159 const vector& planeDir = second();
161 vecs[0] =
vector(1, 0, 0) - planeDir.
x()*planeDir;
163 if (
mag(vecs[0].
x()) < 1
e-3)
165 vecs[0] =
vector(0, 1, 0) - planeDir.
y()*planeDir;
168 vecs[0] /=
mag(vecs[0]);
169 vecs[1] = vecs[0] ^ planeDir;
170 vecs[1] /=
mag(vecs[1]);
172 else if (first() == 2)
178 for (
direction dir =
n; dir < vecs.size(); dir++)
183 tt =
tensor(vecs[0], vecs[1], vecs[2]);
198 else if (first() == 1)
201 cd = d-(d&second())*second();
203 else if (first() == 2)
206 cd = (d&second())*second();
216 inline void Foam::combineConstraintsEqOp::operator()
219 const pointConstraint&
y 229 const pointConstraint& v
232 return pointConstraint
234 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.
const dimensionedScalar e
Elementary charge.
static const Identity< scalar > I
Accumulates point constraints through successive applications of the applyConstraint function...
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.
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Tensor of scalars, i.e. Tensor<scalar>.
pointConstraint()
Construct null.
static constexpr const zero Zero
Global zero (0)