Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
IGeometryMng.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7#ifndef ARCGEOSIM_GEOMETRY_IGEOMETRYSERVICE_H
8#define ARCGEOSIM_GEOMETRY_IGEOMETRYSERVICE_H
9/* Author : havep at Wed Nov 14 13:41:31 2007
10 * Generated by createNew
11 */
12
13#include "arcane/utils/String.h"
14
15#include "arcane/core/ItemGroup.h"
17#include "arcane/core/MeshVariable.h"
19
20/*---------------------------------------------------------------------------*/
21/*---------------------------------------------------------------------------*/
22
23using namespace Arcane;
24
25namespace Arcane::Numerics
26{
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31//! Interface for local geometry computations
32class IGeometry;
33
34/*---------------------------------------------------------------------------*/
35/*---------------------------------------------------------------------------*/
36
37//! Geometric properties
38/*! Some of them are contextual.
39 * For example, the PMeasure of a 3D cell is its PVolume.
40 *
41 * Technical notes: An external container given by the user cannot
42 * be used for anything except the given property.
43 * An internal ItemGroupMap cannot be allocated for a group different
44 * of the group desired by the user.
45 */
46struct ARCANE_GEOMETRY_EXPORT IGeometryProperty
47{
48 enum eProperty
49 {
50 PNone = 0,
51 PMeasure = (1 << 0),
52 PLength = (1 << 1),
53 PArea = (1 << 2),
54 PVolume = (1 << 3),
55 PCenter = (1 << 4),
56 PNormal = (1 << 5),
57 PVolumeSurfaceRatio = (1 << 6),
58 PEnd = (1 << 7) //! Marker for last type
59 };
60
61 enum eStorage
62 {
63 PNoStorage = 0,
64 PVariable = (1 << 0)
65 };
66
67 static bool isScalar(const eProperty p)
68 {
69 return (p & (PMeasure | PLength | PArea | PVolume | PVolumeSurfaceRatio)) != 0;
70 }
71
72 static bool isVectorial(const eProperty p)
73 {
74 return (p & (PCenter | PNormal)) != 0;
75 }
76
77 class Enumerator
78 {
79 public:
80
81 Enumerator()
82 : m_state(1)
83 {}
84 eProperty operator*() const { return (eProperty)m_state; }
85 void operator++() { m_state <<= 1; }
86 bool end() const { return m_state == PEnd; }
87
88 private:
89
90 Integer m_state;
91 };
92
93 static String name(const eProperty p)
94 {
95 switch (p) {
96 case PNone:
97 return "None";
98 case PMeasure:
99 return "Measure";
100 case PLength:
101 return "Length";
102 case PArea:
103 return "Area";
104 case PVolume:
105 return "Volume";
106 case PCenter:
107 return "Center";
108 case PNormal:
109 return "Normal";
110 case PVolumeSurfaceRatio:
111 return "VolumeSurfaceRatio";
112 case PEnd:
113 default:
114 ARCANE_FATAL("Undefined property");
115 }
116 }
117
118 static String name(const eStorage p)
119 {
120 switch (p) {
121 case PNoStorage:
122 return "NoStorage";
123 case PVariable:
124 return "Variable";
125 default:
126 ARCANE_FATAL("Undefined storage");
127 }
128 }
129};
130/*!
131 * \brief Geometric calculation manager.
132 */
133class ARCANE_GEOMETRY_EXPORT IGeometryMng
134{
135 public:
136
137 typedef VariableItemReal RealVariable;
138 typedef VariableItemReal3 Real3Variable;
139
140 public:
141
142 /** Class constructor */
144
145 /** Class destructor */
146 virtual ~IGeometryMng() {};
147
148 public:
149
150 //! Initialization
151 virtual void init() = 0;
152
153 //@{ @name Geometric property management for ItemGroup
154
155 //! Set geometric properties on an ItemGroup
156 virtual void addItemGroupProperty(ItemGroup group, Integer property, Integer storage = IGeometryProperty::PVariable) = 0;
157
158 //! Set geometric properties on an ItemGroup with an external container (real field)
159 virtual void addItemGroupProperty(ItemGroup group, IGeometryProperty::eProperty property, RealVariable var) = 0;
160
161 //! Set geometric properties on an ItemGroup with an external container (real3 field)
162 virtual void addItemGroupProperty(ItemGroup group, IGeometryProperty::eProperty property, Real3Variable var) = 0;
163
164 //! Get set of properties of an ItemGroup
166
167 //! Check if a property is activated on an ItemGroup
168 virtual bool hasItemGroupProperty(ItemGroup group, Integer property) = 0;
169
170 //! Check if a storage is available on an ItemGroup
171 virtual Integer getItemGroupPropertyStorage(ItemGroup group, IGeometryProperty::eProperty property) = 0;
172
173 //@}
174
175 //@{ @name Access to geometric values
176
177 //! Get geometric property values for a Real field
178 virtual const RealVariable& getRealVariableProperty(ItemGroup group, IGeometryProperty::eProperty property) = 0;
179
180 //! Get geometric property values for a Real3 field
181 virtual const Real3Variable& getReal3VariableProperty(ItemGroup group, IGeometryProperty::eProperty property) = 0;
182
183 //@}
184
185 //@{ @name property management by group and properties
186
187 //! Update property values for an ItemGroup
188 virtual void update(ItemGroup group, Integer property) = 0;
189
190 //! Reset property for an ItemGroup
191 virtual void reset(ItemGroup group, Integer property) = 0;
192
193 //@}
194
195 //@{ @name property management by group
196
197 //! Update property values for an ItemGroup
198 virtual void update(ItemGroup group) = 0;
199
200 //! Reset property for an ItemGroup
201 virtual void reset(ItemGroup group) = 0;
202
203 //@}
204
205 //@{ @name global property management
206
207 //! Update property values for all ItemGroups
208 virtual void update() = 0;
209
210 //! Reset property for all ItemGroups
211 virtual void reset() = 0;
212
213 //@}
214
215 //! Get underlying geometry
216 virtual IGeometry* geometry() = 0;
217};
218
219/*---------------------------------------------------------------------------*/
220/*---------------------------------------------------------------------------*/
221
222} // namespace Arcane::Numerics
223
224/*---------------------------------------------------------------------------*/
225/*---------------------------------------------------------------------------*/
226
227#endif
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
Declarations of Arcane's general types.
Mesh entity group.
Definition ItemGroup.h:51
virtual const RealVariable & getRealVariableProperty(ItemGroup group, IGeometryProperty::eProperty property)=0
Get geometric property values for a Real field.
virtual void reset(ItemGroup group)=0
Reset property for an ItemGroup.
virtual Integer getItemGroupPropertyStorage(ItemGroup group, IGeometryProperty::eProperty property)=0
Check if a storage is available on an ItemGroup.
virtual bool hasItemGroupProperty(ItemGroup group, Integer property)=0
Check if a property is activated on an ItemGroup.
virtual void update()=0
Update property values for all ItemGroups.
virtual void update(ItemGroup group, Integer property)=0
Update property values for an ItemGroup.
virtual void reset(ItemGroup group, Integer property)=0
Reset property for an ItemGroup.
virtual void update(ItemGroup group)=0
Update property values for an ItemGroup.
virtual Integer getItemGroupProperty(ItemGroup group)=0
Get set of properties of an ItemGroup.
virtual void reset()=0
Reset property for all ItemGroups.
virtual void init()=0
Initialization.
virtual void addItemGroupProperty(ItemGroup group, IGeometryProperty::eProperty property, RealVariable var)=0
Set geometric properties on an ItemGroup with an external container (real field).
virtual IGeometry * geometry()=0
Get underlying geometry.
virtual void addItemGroupProperty(ItemGroup group, Integer property, Integer storage=IGeometryProperty::PVariable)=0
Set geometric properties on an ItemGroup.
virtual void addItemGroupProperty(ItemGroup group, IGeometryProperty::eProperty property, Real3Variable var)=0
Set geometric properties on an ItemGroup with an external container (real3 field).
virtual const Real3Variable & getReal3VariableProperty(ItemGroup group, IGeometryProperty::eProperty property)=0
Get geometric property values for a Real3 field.
Geometric calculation interface.
Definition IGeometry.h:30
ItemVariableScalarRefT< Real > VariableItemReal
Real type quantity.
ItemVariableScalarRefT< Real3 > VariableItemReal3
3D coordinate type quantity
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Real2 operator*(Real sca, const Real2Proxy &vec)
Multiplication by a scalar.
Definition Real2Proxy.h:364
Int32 Integer
Type representing an integer.