Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
SimpleMeshGenerator.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/*---------------------------------------------------------------------------*/
8/* SimpleMeshGenerator.h (C) 2000-2025 */
9/* */
10/* 'Simple' mesh generation service. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_STD_SIMPLEMESHGENERATOR_H
13#define ARCANE_STD_SIMPLEMESHGENERATOR_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/core/internal/IMeshModifierInternal.h"
18#include "arcane/utils/TraceAccessor.h"
19#include "arcane/utils/Array.h"
20#include "arcane/std/IMeshGenerator.h"
21
22#include <map>
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
27namespace Arcane
28{
29class ItemTypeMng;
30
31/*---------------------------------------------------------------------------*/
32/*---------------------------------------------------------------------------*/
33
37class SimpleMeshGenerator
38: public TraceAccessor
39, public IMeshGenerator
40{
41 public:
42
43 explicit SimpleMeshGenerator(IPrimaryMesh* mesh);
44
45 public:
46
47 ConstArrayView<Int32> communicatingSubDomains() const override { return {}; }
48 bool readOptions(XmlNode node) override;
49 bool generateMesh() override;
50
51 protected:
52
53 Integer _addNode(Real3 position);
54 Integer _addNode(Real x, Real y, Real z);
55 void _addCell(Int16 type_id, ConstArrayView<Int64> nodes_id);
56 void _addCell(ItemTypeId type_id, ConstArrayView<Real3> nodes_coords);
57
58 private:
59
60 Int32 m_mode = 1;
61 IPrimaryMesh* m_mesh = nullptr;
62 ItemTypeMng* m_item_type_mng = nullptr;
63 IMeshModifierInternal* m_mesh_modifier_internal = nullptr;
64 UniqueArray<Int64> m_nodes_unique_id;
65 UniqueArray<Real3> m_nodes_coords;
66 UniqueArray<Int64> m_cells_infos;
67 Integer m_current_nb_cell = 0;
68 typedef std::map<Real3, Integer> Real3Map;
75
76 private:
77
78 void _createSimpleDiTetra5(Real x0, Real y0, Real z1, Real z2);
79 void _createSimpleAntiWedgeRight6(Real x0, Real y0, Real z1, Real z2);
80 void _createSimpleAntiWedgeLeft6(Real x0, Real y0, Real z1, Real z2);
81 void _createSimpleHemiHexa5(Real x0, Real y0, Real z1, Real z2);
82 void _createSimpleHemiHexa6(Real x0, Real y0, Real z1, Real z2);
83 void _createSimpleHemiHexa7(Real x0, Real y0, Real z1, Real z2);
84 void _createSimpleOctaedron12(Real x0, Real y0, Real z1, Real z2);
85 void _createSimpleHeptaedron10(Real x0, Real y0, Real z1, Real z2);
86 void _createSimpleHexaedron8(Real x0, Real y0, Real z1, Real z2);
87 void _createSimpleHexaedron(ItemTypeId type_id, Real x0, Real y0, Real z1, Real z2);
88 void _createSimplePentaedron6(Real x0, Real y0, Real z1, Real z2);
89 void _createSimplePyramid5(Real x0, Real y0, Real z1, Real z2);
90 void _createSimpleTetraedron4(Real x0, Real y0, Real z1, Real z2);
91
92 void _fillHexaedronCoordinates(ItemTypeId type_id, ArrayView<Real3> coords, Real x0, Real y0, Real z1, Real z2);
93
94 static Real3 _center(Real3 n0, Real3 n1)
95 {
96 return (n0 + n1) / 2.0;
97 }
98 static Real3 _center(Real3 n0, Real3 n1, Real3 n2, Real3 n3)
99 {
100 return (n0 + n1 + n2 + n3) / 4.0;
101 }
102 static Real3 _center(ConstArrayView<Real3> coords, Int32 n0, Int32 n1)
103 {
104 return _center(coords[n0], coords[n1]);
105 }
106 static Real3 _center(ConstArrayView<Real3> coords, Int32 n0, Int32 n1, Int32 n2, Int32 n3)
107 {
108 return _center(coords[n0], coords[n1], coords[n2], coords[n3]);
109 }
110};
111
112/*---------------------------------------------------------------------------*/
113/*---------------------------------------------------------------------------*/
114
115} // End namespace Arcane
116
117/*---------------------------------------------------------------------------*/
118/*---------------------------------------------------------------------------*/
119
120#endif
Modifiable view of an array of type T.
Constant view of an array of type T.
Interface of a mesh generator.
Internal part of IMeshModifier.
Type of an entity (Item).
Definition ItemTypeId.h:33
Mesh entity type manager.
Definition ItemTypeMng.h:66
Class managing a 3-dimensional real vector.
Definition Real3.h:132
Integer _addNode(Real3 position)
Adds or retrieves the node with coordinates pos.
Real3Map m_coords_to_uid
Coordinates --> Unique index mapping. For automatic merging of nodes at the same coordinates,...
TraceAccessor(ITraceMng *m)
Constructs an accessor via the trace manager m.
1D data vector with value semantics (STL style).
Node of a DOM tree.
Definition XmlNode.h:51
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
std::int16_t Int16
Signed integer type of 16 bits.
double Real
Type representing a real number.
std::int32_t Int32
Signed integer type of 32 bits.