Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Arcane::IPrimaryMesh Class Referenceabstract

Public Member Functions

virtual VariableNodeReal3nodesCoordinates ()=0
 Node coordinates.
virtual void setDimension (Integer dim)=0
 Positions the mesh dimension (1D, 2D, or 3D).
virtual void reloadMesh ()=0
 Reloads the mesh from protected variables.
virtual void allocateCells (Integer nb_cell, Int64ConstArrayView cells_infos, bool one_alloc=true)=0
 Allocation of a mesh.
virtual void endAllocate ()=0
 Indicates the end of cell allocation.
virtual void deallocate ()=0
 Deallocates the mesh.
virtual IMeshInitialAllocatorinitialAllocator ()
 Specific initial allocator.
virtual VariableItemInt32itemsNewOwner (eItemKind kind)=0
 Variable containing the identifier of the owning subdomain.
virtual void exchangeItems ()=0
 Changes the owning subdomains of entities.
virtual void setOwnersFromCells ()=0
virtual void setMeshPartInfo (const MeshPartInfo &mpi)=0
Public Member Functions inherited from Arcane::IMesh
virtual void build ()=0
virtual String factoryName () const =0
 Name of the factory used to create the mesh.
virtual ItemInternalList itemsInternal (eItemKind)=0
 Internal array of mesh elements of type type.
virtual SharedVariableNodeReal3 sharedNodesCoordinates ()=0
 Node coordinates.
virtual void checkValidMesh ()=0
 Check for the validity of internal mesh structures (internal).
virtual void checkValidMeshFull ()=0
 Mesh validity check.
virtual void synchronizeGroupsAndVariables ()=0
 Synchronizes all mesh groups and variables.
virtual bool isAllocated ()=0
 True if the mesh is allocated.
virtual Int64 timestamp ()=0
 Counter indicating the time of the last mesh modification.
 ARCANE_DEPRECATED_LONG_TERM ("Y2020: Do not use this method. Try to get 'ISubDomain' from another way") virtual ISubDomain *subDomain()=0
 Associated subdomain.
virtual IParallelMngparallelMng ()=0
 Parallelism manager.
virtual VariableScalarInteger connectivity ()=0
 Connectivity descriptor.
virtual CellGroup allActiveCells ()=0
virtual CellGroup ownActiveCells ()=0
 Group of all active cells specific to the domain.
virtual CellGroup allLevelCells (const Integer &level)=0
 Group of all cells of level level.
virtual CellGroup ownLevelCells (const Integer &level)=0
 Group of all cells specific to the domain of level level.
virtual FaceGroup allActiveFaces ()=0
 Group of all active faces.
virtual FaceGroup ownActiveFaces ()=0
 Group of all active faces specific to the domain.
virtual FaceGroup innerActiveFaces ()=0
 Group of all active faces.
virtual FaceGroup outerActiveFaces ()=0
 Group of all active faces on the boundary.
virtual ItemGroupCollection groups ()=0
 List of groups.
virtual ItemGroup findGroup (const String &name)=0
 Returns the group with name name or a null group if none exists.
virtual void destroyGroups ()=0
 Destroys all groups of all families.
virtual MeshItemInternalListmeshItemInternalList ()=0
virtual void updateGhostLayers (bool remove_old_ghost)=0
virtual ARCANE_DEPRECATED_240 void serializeCells (ISerializer *buffer, Int32ConstArrayView cells_local_id)=0
virtual void prepareForDump ()=0
 Prepares the instance for dumping.
virtual void initializeVariables (const XmlNode &init_node)=0
 Initializes variables with values from the configuration file (internal).
virtual void setCheckLevel (Integer level)=0
 Sets the mesh check level.
virtual Integer checkLevel () const =0
 Current check level.
virtual bool isDynamic () const =0
 Indicates if the mesh is dynamic (can evolve).
virtual bool isAmrActivated () const =0
virtual void computeTiedInterfaces (const XmlNode &mesh_node)=0
 Determines the semi-conforming interfaces.
virtual bool hasTiedInterface ()=0
 True if semi-conforming interfaces exist in the mesh.
virtual TiedInterfaceCollection tiedInterfaces ()=0
 List of semi-conforming interfaces.
virtual IMeshPartitionConstraintMngpartitionConstraintMng ()=0
 Manager of partitioning constraints associated with this mesh.
virtual IMeshUtilitiesutilities ()=0
 Associated utility functions interface.
virtual Propertiesproperties ()=0
 Properties associated with this mesh.
virtual IMeshModifiermodifier ()=0
 Associated modifier interface.
virtual void defineParentForBuild (IMesh *mesh, ItemGroup group)=0
 Defines the parent mesh and group.
virtual IMeshparentMesh () const =0
 Access to the parent mesh.
virtual ItemGroup parentGroup () const =0
 Parent group.
virtual void addChildMesh (IMesh *sub_mesh)=0
 Adds a sub-mesh to the parent mesh.
virtual MeshCollection childMeshes () const =0
 List of sub-meshes of the current mesh.
virtual bool isPrimaryMesh () const =0
 Indicates if the instance is a primary mesh.
virtual IPrimaryMeshtoPrimaryMesh ()=0
 Returns the instance in the form of an IPrimaryMesh.
virtual IUserDataListuserDataList ()=0
 Associated user data manager.
virtual const IUserDataListuserDataList () const =0
 Associated user data manager.
virtual IGhostLayerMngghostLayerMng () const =0
 Associated ghost layer manager.
virtual IMeshUniqueIdMngmeshUniqueIdMng () const =0
 Unique ID numbering manager.
virtual IMeshCheckerchecker () const =0
 Checker interface.
virtual const MeshPartInfomeshPartInfo () const =0
 Mesh part information.
virtual bool useMeshItemFamilyDependencies () const =0
 check if the network itemFamily dependencies is activated
virtual IItemFamilyNetworkitemFamilyNetwork ()=0
 Family network interface (connected families).
virtual IIndexedIncrementalItemConnectivityMngindexedConnectivityMng ()=0
 Interface of the indexed incremental connectivity manager.
virtual const MeshKind meshKind () const =0
 Mesh characteristics.
virtual EventObservable< const MeshEventArgs & > & eventObservable (eMeshEventType type)=0
 Observable for an event.
virtual IMeshCompactMng_compactMng ()=0
virtual InternalConnectivityPolicy _connectivityPolicy () const =0
virtual IMeshMngmeshMng () const =0
 Associated mesh manager.
virtual IVariableMngvariableMng () const =0
 Associated variable manager.
virtual ItemTypeMngitemTypeMng () const =0
 Associated entity type manager.
virtual void computeSynchronizeInfos ()=0
 Recalculates synchronization information.
virtual IMeshInternal * _internalApi ()=0
 Internal Arcane API.
Public Member Functions inherited from Arcane::IMeshBase
virtual MeshHandle handle () const =0
 Handle on this mesh.
virtual String name () const =0
 Mesh name.
virtual Integer nbNode ()=0
 Number of mesh nodes.
virtual Integer nbEdge ()=0
 Number of mesh edges.
virtual Integer nbFace ()=0
 Number of mesh faces.
virtual Integer nbCell ()=0
 Number of mesh cells.
virtual Integer nbItem (eItemKind ik)=0
 Number of elements of type ik.
virtual ITraceMngtraceMng ()=0
 Associated message manager.
virtual Integer dimension ()=0
 Mesh dimension (1D, 2D, or 3D).
virtual NodeGroup allNodes ()=0
 Group of all nodes.
virtual EdgeGroup allEdges ()=0
 Group of all edges.
virtual FaceGroup allFaces ()=0
 Group of all faces.
virtual CellGroup allCells ()=0
 Group of all cells.
virtual NodeGroup ownNodes ()=0
 Group of all domain-specific nodes.
virtual EdgeGroup ownEdges ()=0
 Group of all domain-specific edges.
virtual FaceGroup ownFaces ()=0
 Group of all domain-specific faces.
virtual CellGroup ownCells ()=0
 Group of all domain-specific cells.
virtual FaceGroup outerFaces ()=0
 Group of all faces on the boundary.
virtual IItemFamilycreateItemFamily (eItemKind ik, const String &name)=0
 Create a particle family named name.
virtual IItemFamilyfindItemFamily (eItemKind ik, const String &name, bool create_if_needed=false, bool register_modifier_if_created=false)=0
 Returns the family named name.
virtual IItemFamilyfindItemFamily (const String &name, bool throw_exception=false)=0
 Returns the family named name.
virtual IItemFamilyModifierfindItemFamilyModifier (eItemKind ik, const String &name)=0
 Returns the IItemFamilyModifier interface for the family named name and of type ik.
virtual IItemFamilyitemFamily (eItemKind ik)=0
 Returns the entity family of type ik.
virtual IItemFamilynodeFamily ()=0
 Returns the node family.
virtual IItemFamilyedgeFamily ()=0
 Returns the edge family.
virtual IItemFamilyfaceFamily ()=0
 Returns the face family.
virtual IItemFamilycellFamily ()=0
 Returns the cell family.
virtual IItemFamilyCollection itemFamilies ()=0

Detailed Description

Interface of a primary mesh.

Primary mesh instances are created either when reading the dataset, or by programming, by calling one of the IMainFactory::createMesh() methods. Currently, it is not possible to delete a primary mesh.

For example, to create an empty 2D mesh named "Mesh2":

// sd is the current subdomain.
ISubDomain* sd = ...;
IPrimaryMesh* new_mesh = mf->createMesh(sd,pm,"Mesh2");
new_mesh->setDimension(2);
new_mesh->allocateCells(0,Int64ConstArrayView(),false);
new_mesh->endAllocate();
virtual IMainFactory * mainFactory() const =0
Main factory.
virtual IPrimaryMesh * createMesh(ISubDomain *sub_domain, const String &name)=0
Creates or retrieves a mesh.
Interface of the parallelism manager for a subdomain.
virtual void endAllocate()=0
Indicates the end of cell allocation.
virtual void allocateCells(Integer nb_cell, Int64ConstArrayView cells_infos, bool one_alloc=true)=0
Allocation of a mesh.
virtual void setDimension(Integer dim)=0
Positions the mesh dimension (1D, 2D, or 3D).
Interface of the subdomain manager.
Definition ISubDomain.h:75
virtual IApplication * application()=0
Application.
virtual IParallelMng * parallelMng()=0
Returns the parallelism manager.
ConstArrayView< Int64 > Int64ConstArrayView
C equivalent of a 1D array of 64-bit integers.
Definition UtilsTypes.h:480

The created mesh exists across all ranks of the IParallelMng passed as an argument. To create a mesh on a single processor, you can use IParallelMng::sequentialParallelMng().

It is also possible to read a mesh directly from a file using an implementation of IMeshReader. For example, to read a file in the historical Vtk format:

// sd is the current subdomain.
ISubDomain* sd = ...;
IPrimaryMesh* new_mesh = mf->createMesh(sd,pm,"Mesh2");
IMeshReader* reader = ServiceBuilder<IMeshReader>::createInstance(sd,"VtkLegacyMeshReader");
reader->readMeshFromFile(new_mesh,XmlNode(),"sod.vtk","/tmp",false);
delete reader;
Interface of the service managing the reading of a mesh.
Definition IMeshReader.h:33
virtual eReturnType readMeshFromFile(IPrimaryMesh *mesh, const XmlNode &mesh_element, const String &file_name, const String &dir_name, bool use_internal_partition)=0
Reads a mesh from a file.
InterfaceType * createInstance(const String &name, eServiceBuilderProperties properties=SB_None)
Creates an instance implementing the interface InterfaceType.
Node of a DOM tree.
Definition XmlNode.h:51

It is possible to modify the mesh later via the IMeshModifier interface, which can be retrieved by modifier(). Once modifications are made, you must call the endUpdate() method.

A mesh has certain properties, accessible via properties(). The following properties are valid:

  • "sort", boolean, true by default. This property indicates that entities must be sorted after mesh modification so that they are arranged by increasing unique number. This is only useful to ensure that operations always happen in the same parallel order, regardless of the number of subdomains, and that the mesh evolves.
  • "compact", boolean, true by default. This property indicates that entities must be compacted after mesh modification. This means there are no gaps in the numbering and that the local indices localId() of the entities will be numbered from 0 to the number of entities of this type. Compacting is a costly operation because it requires updating all variables to remove gaps in the numbering.
  • "dump", boolean, true by default. This property indicates that the mesh must be saved during a checkpoint.
  • "edges", boolean, false by default. This property indicates that edges must be created in a 3D mesh. NOTE: this property is not currently implemented.
  • "sort-subitemitem-group", boolean, false by default. This property indicates whether groups (dynamically created) containing entities connected to a list of entities (e.g., allCells().nodes()) should be sorted. The sorting only applies to subsequent recalculations, and therefore, if you want all groups of this type to be created, you must set this property during mesh creation.

Definition at line 42 of file IPrimaryMesh.h.

Constructor & Destructor Documentation

◆ ~IPrimaryMesh()

virtual Arcane::IPrimaryMesh::~IPrimaryMesh ( )
inlinevirtual

Definition at line 47 of file IPrimaryMesh.h.

Member Function Documentation

◆ allocateCells()

virtual void Arcane::IPrimaryMesh::allocateCells ( Integer nb_cell,
Int64ConstArrayView cells_infos,
bool one_alloc = true )
pure virtual

Allocation of a mesh.

Creation of an arbitrary mesh.

This method is the most generic of the mesh creation methods. It is used when you only know the cells and the list of their nodes based on their unique global number.

This operation allocates the structures for the mesh containing a number of cells equal to nb_cell, the cells being described by the array cells_infos.

Since the node numbers are unique numbers, their value can be arbitrary: it is not necessary to start at zero, nor must the numbers be consecutive. The implementation handles determining the number of nodes in the mesh.

For example, if we have two cells, the first of type IT_Hexaedron8, with unique number 23, and the second of type IT_Tetraedron4 with unique number 45, the array cells_infos will contain 16 elements, distributed as follows:

cells_infos[0] = IT_Hexaedron8
cells_infos[1] = 23
cells_infos[2...9] = The 8 nodes of the cell
cells_infos[10] = IT_Tetraedron4
cells_infos[11] = 45
cells_infos[12...15] = The 4 nodes of the cell

If nb_cell is zero and cells_infos is not empty, the number of cells is determined dynamically. The array cells_infos is iterated until the end of the array is reached or a cell of type IT_NullType is encountered.

If one_alloc is true, the endAllocate() operation is called to indicate that no other cells will be added. It is possible to allocate the mesh in several steps by setting one_alloc to false and calling endAllocate() at the end.

Warning
When calling this function, the current mesh and all groups are destroyed. This method should only be used to create the initial mesh. If you want to add or remove cells, you must use the IMeshModifier::addCells() or IMeshModifier::removeCells() methods.

◆ deallocate()

virtual void Arcane::IPrimaryMesh::deallocate ( )
pure virtual

Deallocates the mesh.

This deletes all entities and all entity groups. The mesh must then be reallocated via the call to allocateCells(). This call also deletes the mesh dimension, which must be reset by setDimension(). It is therefore possible to change the mesh dimension afterward.

This method is collective.

Warning
This method is experimental and many edge effects are possible. Notably, the current implementation does not support deallocation when there are partial variables on the mesh.

◆ endAllocate()

virtual void Arcane::IPrimaryMesh::endAllocate ( )
pure virtual

Indicates the end of cell allocation.

As long as this method has not been called, it is not valid to use this instance, except for allocating the mesh (allocateCells()).

This method is collective.

◆ exchangeItems()

virtual void Arcane::IPrimaryMesh::exchangeItems ( )
pure virtual

Changes the owning subdomains of entities.

This method is called when load balancing and redistributing the mesh between processors is desired. The method assumes that the IItemsFamily::itemsOwner() variables for each type of mesh entity (node, edge, face, and cell) contain the number of the new owning subdomain for each entity. These variables must be synchronized.

The instance then takes care of giving the cells that belong to it to other processors and receiving new cells from them, and then doing the same for nodes, edges, faces, and particles. The values of the variables and entity groups are also exchanged.

After calling this method, you may need to call the mesh change entry points (ITimeLoopMng::execMeshChangedEntryPoints).

To call this method, isDynamic() must be true.

Calling this method triggers an implicit call to endUpdate().

◆ initialAllocator()

virtual IMeshInitialAllocator * Arcane::IPrimaryMesh::initialAllocator ( )
inlinevirtual

Specific initial allocator.

If null, allocateCells() must be used.

Definition at line 105 of file IPrimaryMesh.h.

Referenced by Arcane::CartesianMeshAllocateBuildInfo::allocateMesh(), and Arcane::UnstructuredMeshAllocateBuildInfo::allocateMesh().

◆ itemsNewOwner()

virtual VariableItemInt32 & Arcane::IPrimaryMesh::itemsNewOwner ( eItemKind kind)
pure virtual

Variable containing the identifier of the owning subdomain.

Returns the variable containing the identifier of the owning subdomain of entities of the given kind.

Warning
This variable is used for generating synchronization messages between subdomains and must not be modified.

◆ nodesCoordinates()

virtual VariableNodeReal3 & Arcane::IPrimaryMesh::nodesCoordinates ( )
pure virtual

Node coordinates.

Implements Arcane::IMesh.

◆ setDimension()

virtual void Arcane::IPrimaryMesh::setDimension ( Integer dim)
pure virtual

Positions the mesh dimension (1D, 2D, or 3D).

The dimension corresponds to the dimension of the cell elements. If cells of multiple dimensions are present, the highest dimension must be indicated.

The dimension must be set before allocating cells if one uses allocateCells(), and must not be modified afterward.


The documentation for this class was generated from the following files: