From c661d93e21af6d5a98c55aeede98e97ca9a0ac4c Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Tue, 25 Jun 2013 16:20:45 +0100 Subject: [PATCH] ENH: pointConstraint: added utility functions --- .../pointConstraint/pointConstraint.H | 25 +++++++++++++-- .../pointConstraint/pointConstraintI.H | 31 ++++++++++++++++++- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraint.H b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraint.H index 7f4f667c30f..5b48463befa 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraint.H +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraint.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,10 +41,9 @@ SourceFiles #define pointConstraint_H #include "label.H" -#include "uLabel.H" #include "vector.H" -#include "tensor.H" #include "Tuple2.H" +#include "transform.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -67,6 +66,9 @@ public: //- Construct null inline pointConstraint(); + //- Construct from components + inline pointConstraint(const Tuple2<label, vector>&); + //- Construct from Istream inline pointConstraint(Istream&); @@ -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 diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraintI.H b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraintI.H index 698e62a9446..0915a301d4d 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraintI.H +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraintI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -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) : Tuple2<label, vector>(is) @@ -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())) + ); +} + + // ************************************************************************* // -- GitLab