mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Added combine function to combine two pointConstraints
This commit is contained in:
@ -77,6 +77,9 @@ public:
|
|||||||
//- Apply and accumulate the effect of the given constraint direction
|
//- Apply and accumulate the effect of the given constraint direction
|
||||||
inline void applyConstraint(const vector& cd);
|
inline void applyConstraint(const vector& cd);
|
||||||
|
|
||||||
|
//- Combine constraints
|
||||||
|
inline void combine(const pointConstraint&);
|
||||||
|
|
||||||
//- Return the accumulated constraint transformation tensor
|
//- Return the accumulated constraint transformation tensor
|
||||||
inline tensor constraintTransformation() const;
|
inline tensor constraintTransformation() const;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -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
|
Foam::tensor Foam::pointConstraint::constraintTransformation() const
|
||||||
{
|
{
|
||||||
if (first() == 0)
|
if (first() == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user