Loading...
Searching...
No Matches
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-2025 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::pointConstraint
29
30Description
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
38SourceFiles
39 pointConstraintI.H
40 pointConstraint.C
41
42\*---------------------------------------------------------------------------*/
43
44#ifndef Foam_pointConstraint_H
45#define Foam_pointConstraint_H
46
47#include "label.H"
48#include "vector.H"
49#include "Tuple2.H"
50#include "transform.H"
51#include "contiguous.H"
52
53// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54
55namespace Foam
56{
58// Forward Declarations
59class pointConstraint;
60
64/*---------------------------------------------------------------------------*\
65 Class pointConstraint Declaration
66\*---------------------------------------------------------------------------*/
67
69:
70 public Tuple2<label, vector>
71{
72public:
73
74 // Constructors
75
76 //- Default construct zero-initialized
77 inline pointConstraint();
78
79 //- Construct from components
81
82 //- Construct from components
83 inline pointConstraint(const label count, const vector& n);
84
85 //- Construct from Istream.
86 //- Handles ASCII only, since that is what Tuple2 does.
87 inline explicit pointConstraint(Istream&);
88
89
90 // Member Functions
91
92 //- Apply and accumulate the effect of the given constraint direction
93 inline void applyConstraint(const vector& cd);
94
95 //- Combine constraints
96 inline void combine(const pointConstraint&);
97
98 //- Return the accumulated constraint transformation tensor
99 inline tensor constraintTransformation() const;
100
101 //- Return the accumulated unconstrained directions.
102 //- Directions coded as first n rows of tensor.
103 inline void unconstrainedDirections(label& n, tensor& vecs) const;
104
105 //- Constrain a displacement
106 inline vector constrainDisplacement(const vector& disp) const;
107};
108
109
110// * * * * * * * * * * * * * * * Specializations * * * * * * * * * * * * * * //
111
112// NB: specialized readContiguous<pointConstraint> declared in Istream.H
113
114//- Template specialisation for pTraits<pointConstraint> to enable IO
115template<>
117{
118 static const char* const typeName;
119};
120
121//- Contiguous data for pointConstraint
122template<> struct is_contiguous<pointConstraint> : std::true_type {};
123
124
125//- Reduce operator
127{
128 void operator()(pointConstraint& x, const pointConstraint& y) const
129 {
130 x.combine(y);
132};
134
135// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
136
137//- Transformation function
138inline pointConstraint transform(const tensor& tt, const pointConstraint& v);
140
141// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142
143} // End namespace Foam
144
145// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146
148
149// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150
151#endif
152
153// ************************************************************************* //
scalar y
label n
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
A traits class, which is primarily used for primitives and vector-space.
Definition pTraits.H:64
pTraits(const pointConstraint &obj)
Definition pTraits.H:72
Accumulates point constraints through successive applications of the applyConstraint function.
void combine(const pointConstraint &)
Combine constraints.
void applyConstraint(const vector &cd)
Apply and accumulate the effect of the given constraint direction.
pointConstraint()
Default construct zero-initialized.
tensor constraintTransformation() const
Return the accumulated constraint transformation tensor.
void unconstrainedDirections(label &n, tensor &vecs) const
Return the accumulated unconstrained directions. Directions coded as first n rows of tensor.
vector constrainDisplacement(const vector &disp) const
Constrain a displacement.
Tensor of scalars, i.e. Tensor<scalar>.
Namespace for OpenFOAM.
refinementData transform(const tensor &, const refinementData val)
No-op rotational transform for base types.
List< pointConstraint > pointConstraintList
List of pointConstraint.
Tensor< scalar > tensor
Definition symmTensor.H:57
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Vector< scalar > vector
Definition vector.H:57
void operator()(pointConstraint &x, const pointConstraint &y) const
A template class to specify that a data type can be considered as being contiguous in memory.
Definition contiguous.H:70
static const char *const typeName
3D tensor transformation operations.