pointConstraint.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::pointConstraint
29 
30 Description
31  Accumulates point constraints through successive applications of the
32  applyConstraint function.
33 
34  After all the constraints have been entered the resulting
35  transformation tensor is returned by the constraintTransformation
36  function.
37 
38 SourceFiles
39  pointConstraintI.H
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef pointConstraint_H
44 #define pointConstraint_H
45 
46 #include "label.H"
47 #include "vector.H"
48 #include "Tuple2.H"
49 #include "transform.H"
50 #include "contiguous.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class pointConstraint Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 class pointConstraint
62 :
63  public Tuple2<label, vector>
64 {
65 
66 public:
67 
68  // Constructors
69 
70  //- Construct null
71  inline pointConstraint();
72 
73  //- Construct from components
75 
76  //- Construct from Istream
77  inline pointConstraint(Istream&);
78 
79 
80  // Member Functions
81 
82  //- Apply and accumulate the effect of the given constraint direction
83  inline void applyConstraint(const vector& cd);
84 
85  //- Combine constraints
86  inline void combine(const pointConstraint&);
87 
88  //- Return the accumulated constraint transformation tensor
89  inline tensor constraintTransformation() const;
90 
91  //- Return the accumulated unconstrained directions. Directions
92  // coded as first n rows of tensor.
93  inline void unconstrainedDirections(label& n, tensor& vecs) const;
94 
95  //- Constrain a displacement
96  inline vector constrainDisplacement(const vector& disp) const;
97 };
98 
99 
100 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
101 
102 //- Contiguous data for pointConstraint
103 template<> struct is_contiguous<pointConstraint> : std::true_type {};
104 
105 
106 //- Reduce operator
107 class combineConstraintsEqOp
108 {
109 public:
110  inline void operator()(pointConstraint&, const pointConstraint&) const;
111 };
112 
113 
114 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
115 
116 //- Transformation function
117 inline pointConstraint transform(const tensor& tt, const pointConstraint& v);
118 
119 
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 
122 } // End namespace Foam
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 #include "pointConstraintI.H"
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 #endif
131 
132 // ************************************************************************* //
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
Definition: stringOps.H:54
void unconstrainedDirections(label &n, tensor &vecs) const
Return the accumulated unconstrained directions. Directions.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
void combine(const pointConstraint &)
Combine constraints.
void applyConstraint(const vector &cd)
Apply and accumulate the effect of the given constraint direction.
3D tensor transformation operations.
Accumulates point constraints through successive applications of the applyConstraint function...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
void operator()(pointConstraint &, const pointConstraint &) const
tensor constraintTransformation() const
Return the accumulated constraint transformation tensor.
vector constrainDisplacement(const vector &disp) const
Constrain a displacement.
A template class to specify that a data type can be considered as being contiguous in memory...
Definition: contiguous.H:70
label n
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:521
Tensor of scalars, i.e. Tensor<scalar>.
pointConstraint()
Construct null.
Namespace for OpenFOAM.