diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraint.H b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraint.H index 5e28ac1e1439785bfa8d388092f70e52a9df6494..10aa63f2c9f629bb707d1e9ac5faab30b1a362fc 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraint.H +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraint.H @@ -77,6 +77,9 @@ public: //- Apply and accumulate the effect of the given constraint direction inline void applyConstraint(const vector& cd); + //- Combine constraints + inline void combine(const pointConstraint&); + //- Return the accumulated constraint transformation tensor inline tensor constraintTransformation() const; }; diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraintI.H b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraintI.H index a0af05b5afad4c5530bcabd0f8ab02b0496c0acb..c488bf603e57e6e6eb79f6712492b54cf52f8c18 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraintI.H +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraintI.H @@ -69,6 +69,47 @@ void Foam::pointConstraint::applyConstraint(const vector& cd) } +void Foam::pointConstraint::combine(const pointConstraint& pc) +{ + if (first() == 0) + { + operator=(pc); + } + else if (first() == 1) + { + // Save single normal + vector n = second(); + // Apply to supplied point constaint + operator=(pc); + applyConstraint(n); + } + else if (first() == 2) + { + if (pc.first() == 0) + {} + else if (pc.first() == 1) + { + applyConstraint(pc.second()); + } + else if (pc.first() == 2) + { + // Both constrained to line. Same (+-)direction? + if (mag(second() & pc.second()) <= (1.0-1e-3)) + { + // Different directions + first() = 3; + second() = vector::zero; + } + } + else + { + first() = 3; + second() = vector::zero; + } + } +} + + Foam::tensor Foam::pointConstraint::constraintTransformation() const { if (first() == 0)