14#include "arcane/core/IMesh.h"
15#include "arcane/core/IMeshFactoryMng.h"
16#include "arcane/core/IMeshMng.h"
17#include "arcane/core/IMeshModifier.h"
18#include "arcane/core/IPrimaryMesh.h"
19#include "arcane/core/MeshBuildInfo.h"
21#include "arcane/core/IMeshSection.h"
22#include "arcane/std/MeshSection_axl.h"
42class MeshSectionService
63 return m_cloned_mesh->handle();
77 Int32 m_mesh_uid = -1;
84ARCANE_REGISTER_SERVICE_MESHSECTION(MeshSection, MeshSectionService);
105 ARCANE_NOT_YET_IMPLEMENTED(
"Not supported yet");
115 m_mesh_uid = unique_id;
131void MeshSectionService::
134 if (m_cloned_mesh !=
nullptr) {
138 IMeshMng* mm = subDomain()->
meshMng();
140 if (m_mesh_uid == -1) {
142 m_mesh_uid =
options()->getUniqueIdServiceMesh();
149 String service_mesh_name = mesh()->name() +
"_MeshSection" + m_mesh_uid;
151 MeshHandle* mesh_handle = mm->
findMeshHandle(service_mesh_name,
false);
153 if (mesh_handle ==
nullptr) {
154 IParallelMng* pm = subDomain()->parallelMng();
155 MeshBuildInfo mbi(service_mesh_name);
156 mbi.addParallelMng(
makeRef(pm));
157 m_cloned_mesh = mm->meshFactoryMng()->createMesh(mbi);
158 m_cloned_mesh->modifier()->setDynamic(
true);
159 m_cloned_mesh->setDimension(mesh()->dimension());
160 m_cloned_mesh->endAllocate();
163 m_cloned_mesh = mesh_handle->mesh()->toPrimaryMesh();
164 m_cloned_mesh->modifier()->clearItems();
171void MeshSectionService::
177 is_added.fill(
false);
182 for (Node node : icell->nodes()) {
183 b += node_coord[node];
185 b /= icell->nbNode();
188 for (
auto& [p0, normal] : m_plans) {
200 Int16 cell_type = icell->itemTypeId();
201 cells_infos.add(cell_type);
203 Int64 cell_uid = icell->uniqueId().asInt64();
204 cells_infos.add(cell_uid);
206 for (Node node : icell->nodes()) {
207 Int64 node_uid = node.uniqueId().asInt64();
208 cells_infos.add(node_uid);
209 pos_node[node.uniqueId()] = node_coord[node];
213 for (Face face : icell->faces()) {
214 if (is_added[face])
continue;
215 is_added[face] =
true;
217 Int16 face_type = face.itemTypeId();
218 faces_infos.add(face_type);
220 Int64 face_uid = face.uniqueId().asInt64();
221 faces_infos.add(face_uid);
223 for (Node node : face.nodes()) {
224 Int64 node_uid = node.uniqueId().asInt64();
225 faces_infos.add(node_uid);
226 pos_node[node.uniqueId()] = node_coord[node];
236void MeshSectionService::
239 UniqueArray<Int64> cells_infos;
240 cells_infos.reserve(10000);
242 UniqueArray<Int64> faces_infos;
243 faces_infos.reserve(10000);
245 std::unordered_map<Int64, Real3> coord_map;
250 _createCells(nb_cell, cells_infos, nb_face, faces_infos, coord_map);
252 m_cloned_mesh->modifier()->addFaces(nb_face, faces_infos);
253 m_cloned_mesh->modifier()->addCells(nb_cell, cells_infos);
254 m_cloned_mesh->modifier()->endUpdate();
258 ENUMERATE_ (Node, inode, m_cloned_mesh->allNodes()) {
259 node_coords[inode] = coord_map[inode->uniqueId()];
263 info() <<
"New mesh -- NbNode : " << m_cloned_mesh->nbNode() <<
" -- NbCells : " << m_cloned_mesh->nbCell();
ArcaneMeshSectionObject(const Arcane::ServiceBuildInfo &sbi)
Constructeur.
CaseOptionsMeshSection * options() const
Options du jeu de données du service.
virtual MeshHandle * findMeshHandle(const String &name, bool throw_exception)=0
Searches for the mesh with name name.
virtual void clearItems()=0
Deletes all entities of all families in this mesh.
virtual IMeshModifier * modifier()=0
Associated modifier interface.
virtual IMeshMng * meshMng() const =0
Returns the mesh manager.
CellGroup ownCells() const
Returns the group containing all cells specific to this domain.
void addPlane(const Real3 &p0, const Real3 &normal) override
Method allowing to add a plane to the cut service. The use of these planes depends on the service.
void updateSection() override
Method allowing to update the mesh section with all planes.
MeshHandle meshSection() override
Méthod allowing to get the mesh section.
VariableCollection variables() override
Method allowing to get a set of variables copied on the new mesh.
void setVariables(VariableCollection variables) override
Method allowing to add a set of variables to copy on the new mesh.
void setServiceMeshUniqueId(Int32 unique_id) override
Method allowing to set a unique id allowing to create multiple section services for a mesh.
Class managing a 3-dimensional real vector.
eServiceType creationType() const
Type of service that can be created by this instance.
Structure containing the information to create a service.
TraceMessage info() const
Flow for an information message.
1D data vector with value semantics (STL style).
__host__ __device__ Real dot(Real2 u, Real2 v)
Dot product of u by v in .
__host__ __device__ Real3 normalizeReal3(Real3 v)
Normalization of a Real3.
MeshVariableScalarRefT< Face, Byte > VariableFaceBool
Quantity at the face of boolean type.
MeshVariableScalarRefT< Node, Real3 > VariableNodeReal3
Coordinate type quantity at node.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Signed integer type of 64 bits.
eServiceType
Service type.
@ ST_CaseOption
The service is used at the dataset level.
std::int16_t Int16
Signed integer type of 16 bits.
double Real
Type representing a real number.
auto makeRef(InstanceType *t) -> Ref< InstanceType >
Creates a reference on a pointer.
@ Cell
The mesh is AMR by cell.
std::int32_t Int32
Signed integer type of 32 bits.