Commit 77816563 authored by Henry Weller's avatar Henry Weller
Browse files

pointConstraint: Added constrainDisplacement

which directly applies the constraint to the displacement without
external tensor ops.

Patch contributed by Mattijs Janssens
parent 9efe9440
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -87,6 +87,9 @@ public:
//- Return the accumulated unconstrained directions. Directions
// coded as first n rows of tensor.
inline void unconstrainedDirections(label& n, tensor& vecs) const;
//- Constrain a displacement
inline vector constrainDisplacement(const vector& disp) const;
};
......@@ -103,7 +106,7 @@ inline pointConstraint transform(const tensor& tt, const pointConstraint& v);
//- contiguous
template<class T> bool contiguous();
template<>
inline bool contiguous<pointConstraint>() {return true;}
inline bool contiguous<pointConstraint>() {return true;}
......
......@@ -45,7 +45,7 @@ inline Foam::pointConstraint::pointConstraint(Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::pointConstraint::applyConstraint(const vector& cd)
inline void Foam::pointConstraint::applyConstraint(const vector& cd)
{
if (first() == 0)
{
......@@ -74,7 +74,7 @@ void Foam::pointConstraint::applyConstraint(const vector& cd)
}
void Foam::pointConstraint::combine(const pointConstraint& pc)
inline void Foam::pointConstraint::combine(const pointConstraint& pc)
{
if (first() == 0)
{
......@@ -115,7 +115,7 @@ void Foam::pointConstraint::combine(const pointConstraint& pc)
}
Foam::tensor Foam::pointConstraint::constraintTransformation() const
inline Foam::tensor Foam::pointConstraint::constraintTransformation() const
{
if (first() == 0)
{
......@@ -136,8 +136,11 @@ Foam::tensor Foam::pointConstraint::constraintTransformation() const
}
void Foam::pointConstraint::unconstrainedDirections(label& n, tensor& tt)
const
inline void Foam::pointConstraint::unconstrainedDirections
(
label& n,
tensor& tt
) const
{
n = 3-first();
......@@ -179,7 +182,36 @@ const
}
void Foam::combineConstraintsEqOp::operator()
inline Foam::vector Foam::pointConstraint::constrainDisplacement
(
const vector& d
) const
{
vector cd;
if (first() == 0)
{
cd = d;
}
else if (first() == 1)
{
// Remove plane normal
cd = d-(d&second())*second();
}
else if (first() == 2)
{
// Keep line direction only
cd = (d&second())*second();
}
else
{
cd = Zero;
}
return cd;
}
inline void Foam::combineConstraintsEqOp::operator()
(
pointConstraint& x,
const pointConstraint& y
......@@ -189,7 +221,7 @@ void Foam::combineConstraintsEqOp::operator()
}
Foam::pointConstraint Foam::transform
inline Foam::pointConstraint Foam::transform
(
const tensor& tt,
const pointConstraint& v
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment