Skip to content
Snippets Groups Projects
Commit c661d93e authored by mattijs's avatar mattijs
Browse files

ENH: pointConstraint: added utility functions

parent 9fc91675
Branches
Tags
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -41,10 +41,9 @@ SourceFiles ...@@ -41,10 +41,9 @@ SourceFiles
#define pointConstraint_H #define pointConstraint_H
#include "label.H" #include "label.H"
#include "uLabel.H"
#include "vector.H" #include "vector.H"
#include "tensor.H"
#include "Tuple2.H" #include "Tuple2.H"
#include "transform.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...@@ -67,6 +66,9 @@ public: ...@@ -67,6 +66,9 @@ public:
//- Construct null //- Construct null
inline pointConstraint(); inline pointConstraint();
//- Construct from components
inline pointConstraint(const Tuple2<label, vector>&);
//- Construct from Istream //- Construct from Istream
inline pointConstraint(Istream&); inline pointConstraint(Istream&);
...@@ -84,6 +86,23 @@ public: ...@@ -84,6 +86,23 @@ public:
}; };
//- reduce operator
class combineConstraintsEqOp
{
public:
inline void operator()(pointConstraint&, const pointConstraint&) const;
};
//- transformation function
inline pointConstraint transform(const tensor& tt, const pointConstraint& v);
//- contiguous
template<class T> bool contiguous();
template<>
inline bool contiguous<pointConstraint>() {return true;}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -31,6 +31,12 @@ inline Foam::pointConstraint::pointConstraint() ...@@ -31,6 +31,12 @@ inline Foam::pointConstraint::pointConstraint()
{} {}
inline Foam::pointConstraint::pointConstraint(const Tuple2<label, vector>& pc)
:
Tuple2<label, vector>(pc)
{}
inline Foam::pointConstraint::pointConstraint(Istream& is) inline Foam::pointConstraint::pointConstraint(Istream& is)
: :
Tuple2<label, vector>(is) Tuple2<label, vector>(is)
...@@ -130,4 +136,27 @@ Foam::tensor Foam::pointConstraint::constraintTransformation() const ...@@ -130,4 +136,27 @@ Foam::tensor Foam::pointConstraint::constraintTransformation() const
} }
void Foam::combineConstraintsEqOp::operator()
(
pointConstraint& x,
const pointConstraint& y
) const
{
x.combine(y);
}
Foam::pointConstraint Foam::transform
(
const tensor& tt,
const pointConstraint& v
)
{
return pointConstraint
(
Tuple2<label, vector>(v.first(), transform(tt, v.second()))
);
}
// ************************************************************************* // // ************************************************************************* //
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