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 components
77  inline pointConstraint(const label count, const vector& n);
78 
79  //- Construct from Istream
80  inline pointConstraint(Istream&);
81 
82 
83  // Member Functions
84 
85  //- Apply and accumulate the effect of the given constraint direction
86  inline void applyConstraint(const vector& cd);
87 
88  //- Combine constraints
89  inline void combine(const pointConstraint&);
90 
91  //- Return the accumulated constraint transformation tensor
92  inline tensor constraintTransformation() const;
93 
94  //- Return the accumulated unconstrained directions. Directions
95  // coded as first n rows of tensor.
96  inline void unconstrainedDirections(label& n, tensor& vecs) const;
97 
98  //- Constrain a displacement
99  inline vector constrainDisplacement(const vector& disp) const;
100 };
101 
102 
105 
106 
107 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
108 
109 //- Template specialisation for pTraits<pointConstraint> to enable IO
110 template<>
111 struct pTraits<pointConstraint>
112 {
113  static const char* const typeName;
114 };
115 
116 //- Contiguous data for pointConstraint
117 template<> struct is_contiguous<pointConstraint> : std::true_type {};
119 
120 //- Reduce operator
122 {
123 public:
124  inline void operator()(pointConstraint&, const pointConstraint&) const;
125 };
126 
128 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
130 //- Transformation function
131 inline pointConstraint transform(const tensor& tt, const pointConstraint& v);
132 
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 } // End namespace Foam
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 #include "pointConstraintI.H"
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 #endif
145 
146 // ************************************************************************* //
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
Definition: stringOps.H:54
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:56
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
A traits class, which is primarily used for primitives and vector-space.
Definition: pTraits.H:75
List< pointConstraint > pointConstraintList
List of pointConstraint.
void combine(const pointConstraint &)
Combine constraints.
void applyConstraint(const vector &cd)
Apply and accumulate the effect of the given constraint direction.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of &#39;true&#39; entries.
Definition: BitOps.H:73
3D tensor transformation operations.
Accumulates point constraints through successive applications of the applyConstraint function...
refinementData transform(const tensor &, const refinementData val)
No-op rotational transform for base types.
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.
label n
Tensor of scalars, i.e. Tensor<scalar>.
pointConstraint()
Construct null.
Namespace for OpenFOAM.