Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
GeometryTemplatesT.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 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_IMPL_GEOMETRYTEMPLATES_H
8#define ARCGEOSIM_GEOMETRY_IMPL_GEOMETRYTEMPLATES_H
9
10#include <arcane/IMesh.h>
11using namespace Arcane;
12
13#include <arcane/IItemOperationByBasicType.h>
14
15#include <arcane/IItemFamily.h>
16#include <arcane/ArcaneVersion.h>
17#include <arcane/utils/ITraceMng.h>
18#include <arcane/MathUtils.h>
19#include <arcane/ItemVectorView.h>
20
21#include "arcane/geometry/impl/ItemGroupGeometryProperty.h"
22
23ARCANE_BEGIN_NAMESPACE
24NUMERICS_BEGIN_NAMESPACE
25
26template <typename GeometryT>
28{
29 private:
30 GeometryT& m_geom;
31 ItemGroupGeometryProperty* m_group_property = nullptr;
32 ITraceMng* m_trace_mng;
33
34public:
36 : m_geom(geom), m_trace_mng(traceMng) { }
37
38 void setGroupProperty(ItemGroupGeometryProperty * group_property)
39 {
40 m_group_property = group_property;
41 }
42
43#define SAVE_PROPERTY(property,type,item,group,expr) \
44 if (m_group_property->hasProperty((property))) \
45 { \
46 ItemGroupGeometryProperty::StorageInfo & storage = m_group_property->storages[property]; \
47 if (ContainerAccessorT<type>::getVarContainer(storage)) \
48 { \
49 IGeometryMng::type##Variable & mMap = *ContainerAccessorT<type>::getVarContainer(storage); \
50 ENUMERATE_ITEMWITHNODES((item), (group)) { \
51 mMap[*(item)] = (expr); \
52 } \
53 } \
54 }
55
56 template<typename ComputeLineFunctor>
57 void applyLineTemplate(ItemVectorView group)
58 {
59 // Utilise des tableaux locaux plutot qu'une spécialisation par type de propriété (moins de code, plus de souplesse)
62
63 ComputeLineFunctor functor(&m_geom);
64 ENUMERATE_ITEMWITHNODES(item, group) {
65 functor.computeOrientedMeasureAndCenter(*item,orientations[item.index()],centers[item.index()]);
66 }
67
68 SAVE_PROPERTY(IGeometryProperty::PMeasure,Real,item,group,math::normeR3(orientations[item.index()]));
69 SAVE_PROPERTY(IGeometryProperty::PLength,Real,item,group,math::normeR3(orientations[item.index()]));
70 SAVE_PROPERTY(IGeometryProperty::PArea,Real,item,group,0);
71 SAVE_PROPERTY(IGeometryProperty::PVolume,Real,item,group,0);
72 SAVE_PROPERTY(IGeometryProperty::PCenter,Real3,item,group,centers[item.index()]);
73 SAVE_PROPERTY(IGeometryProperty::PNormal,Real3,item,group,orientations[item.index()]);
74 SAVE_PROPERTY(IGeometryProperty::PVolumeSurfaceRatio,Real,item,group,0);
75 }
76
77 template<typename ComputeSurfaceFunctor>
78 void applySurfaceTemplate(ItemVectorView group)
79 {
80 // Utilise des tableaux locaux plutot qu'une spécialisation par type de propriété (moins de code, plus de souplesse)
83
84 ComputeSurfaceFunctor functor(&m_geom);
85 ENUMERATE_ITEMWITHNODES(item, group) {
86 functor.computeOrientedMeasureAndCenter(*item,normals[item.index()],centers[item.index()]);
87 }
88
89 SAVE_PROPERTY(IGeometryProperty::PMeasure,Real,item,group,math::normeR3(normals[item.index()]));
90 SAVE_PROPERTY(IGeometryProperty::PLength,Real,item,group,0);
91 SAVE_PROPERTY(IGeometryProperty::PArea,Real,item,group,math::normeR3(normals[item.index()]));
92 SAVE_PROPERTY(IGeometryProperty::PVolume,Real,item,group,0);
93 SAVE_PROPERTY(IGeometryProperty::PCenter,Real3,item,group,centers[item.index()]);
94 SAVE_PROPERTY(IGeometryProperty::PNormal,Real3,item,group,normals[item.index()]);
95 SAVE_PROPERTY(IGeometryProperty::PVolumeSurfaceRatio,Real,item,group,0);
96 }
97
98 template<typename ComputeVolumeFunctor>
99 void applyVolumeTemplate(ItemVectorView group)
100 {
101 // Utilise des tableaux locaux plutot qu'une spécialisation par type de propriété (moins de code, plus de souplesse)
104
105 ComputeVolumeFunctor functor(&m_geom);
106 ENUMERATE_ITEMWITHNODES(item, group) {
107 functor.computeOrientedMeasureAndCenter(*item,volumes[item.index()],centers[item.index()]);
108 }
109
110 SAVE_PROPERTY(IGeometryProperty::PMeasure,Real,item,group,volumes[item.index()]);
111 SAVE_PROPERTY(IGeometryProperty::PLength,Real,item,group,0);
112 SAVE_PROPERTY(IGeometryProperty::PArea,Real,item,group,0);
113 SAVE_PROPERTY(IGeometryProperty::PVolume,Real,item,group,volumes[item.index()]);
114 SAVE_PROPERTY(IGeometryProperty::PCenter,Real3,item,group,centers[item.index()]);
115 SAVE_PROPERTY(IGeometryProperty::PNormal,Real3,item,group,0);
116
117 if (m_group_property->hasProperty((IGeometryProperty::PVolumeSurfaceRatio)))
118 {
120 ENUMERATE_ITEMWITHNODES(item, group) {
121 functor.computeVolumeArea(*item,areas[item.index()]);
122 }
123 SAVE_PROPERTY(IGeometryProperty::PVolumeSurfaceRatio,Real,item,group,volumes[item.index()]/areas[item.index()]);
124 }
125 }
126
127 void applyVertex(ItemVectorView group) { ARCANE_UNUSED(group); }
128
129 void applyLine2(ItemVectorView group) {
131 }
132
133 void applyTriangle3(ItemVectorView group) {
135 }
136
137 void applyQuad4(ItemVectorView group) {
139 }
140
141 void applyPentagon5(ItemVectorView group) {
143 }
144
145 void applyHexagon6(ItemVectorView group) {
147 }
148
149 void applyTetraedron4(ItemVectorView group)
150 {
152 }
153
154 void applyPyramid5(ItemVectorView group) {
156 }
157
158 void applyPentaedron6(ItemVectorView group) {
160 }
161
162 void applyHexaedron8(ItemVectorView group) {
164 }
165
166 void applyHeptaedron10(ItemVectorView group) {
168 }
169
170 void applyOctaedron12(ItemVectorView group) {
172 }
173
174 void applyHemiHexa7(ItemVectorView group) {
176 }
177
178 void applyHemiHexa6(ItemVectorView group) {
180 }
181
182 void applyHemiHexa5(ItemVectorView group) {
184 }
185
186 void applyAntiWedgeLeft6(ItemVectorView group) {
188 }
189
190 void applyAntiWedgeRight6(ItemVectorView group) {
192 }
193
194 void applyDiTetra5(ItemVectorView group) {
196 }
197
198 void applyDualNode(ItemVectorView group) { ARCANE_UNUSED(group); }
199 void applyDualEdge(ItemVectorView group) { ARCANE_UNUSED(group); }
200 void applyDualFace(ItemVectorView group) { ARCANE_UNUSED(group); }
201 void applyDualCell(ItemVectorView group) { ARCANE_UNUSED(group); }
202 void applyLine3(ItemVectorView group) { ARCANE_UNUSED(group); }
203 void applyLine4(ItemVectorView group) { ARCANE_UNUSED(group); }
204 void applyLine5(ItemVectorView group) { ARCANE_UNUSED(group); }
205 void applyLine9(ItemVectorView group) { ARCANE_UNUSED(group); }
206 void applyLink(ItemVectorView group) { ARCANE_UNUSED(group); }
207};
208
209NUMERICS_END_NAMESPACE
210ARCANE_END_NAMESPACE
211
212#endif /* ARCGEOSIM_GEOMETRY_IMPL_GEOMETRYTEMPLATES_H */
Interface d'un opérateur sur des entités rangées par type.
Internal class implementation for TemisGeometryService and Euclidian3GeometryService.
Vue sur un vecteur d'entités.
Int32 size() const
Nombre d'éléments du vecteur.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Classe gérant un vecteur de réel de dimension 3.
Definition Real3.h:132
Interface du gestionnaire de traces.
Real normeR3(Real3 v1)
Norme d'un vecteur.
Definition MathUtils.h:653
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-