Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::CartesianMeshCoarsening Class Reference

Coarsens a Cartesian mesh by 2. More...

#include <arcane/cartesianmesh/CartesianMeshCoarsening.h>

Inheritance diagram for Arcane::CartesianMeshCoarsening:
Collaboration diagram for Arcane::CartesianMeshCoarsening:

Public Member Functions

void createCoarseCells ()
 Coarsens the initial mesh by 2.
ConstArrayView< Int32refinedCells (Int32 index) const
 List of localIds() of refined cells for the parent cell at index index.
ConstArrayView< Int32coarseCells () const
 List of localIds() of coarse cells.
void removeRefinedCells ()
 Removes refined cells.
Public Member Functions inherited from Arcane::TraceAccessor
 TraceAccessor (ITraceMng *m)
 Constructs an accessor via the trace manager m.
 TraceAccessor (const TraceAccessor &rhs)
 Copy constructor.
TraceAccessoroperator= (const TraceAccessor &rhs)
 Copy assignment operator.
virtual ~TraceAccessor ()
 Frees resources.
ITraceMngtraceMng () const
 Trace manager.
TraceMessage info () const
 Flow for an information message.
TraceMessage pinfo () const
 Flow for a parallel information message.
TraceMessage info (char category) const
 Flow for an information message of a given category.
TraceMessage pinfo (char category) const
 Flow for a parallel information message of a given category.
TraceMessage info (bool v) const
 Flow for an information message.
TraceMessage warning () const
 Flow for a warning message.
TraceMessage pwarning () const
TraceMessage error () const
 Flow for an error message.
TraceMessage perror () const
TraceMessage log () const
 Flow for a log message.
TraceMessage plog () const
 Flow for a log message.
TraceMessage logdate () const
 Flow for a log message preceded by the date.
TraceMessage fatal () const
 Flow for a fatal error message.
TraceMessage pfatal () const
 Flow for a parallel fatal error message.
TraceMessageDbg debug (Trace::eDebugLevel=Trace::Medium) const
 Flow for a debug message.
Trace::eDebugLevel configDbgLevel () const
 Debug level of the configuration file.
TraceMessage info (Int32 verbose_level) const
 Flow for an information message of a given level.
TraceMessage linfo () const
 Flow for an information message with the local information level of this instance.
TraceMessage linfo (Int32 relative_level) const
 Flow for an information message with the local information level of this instance.
void fatalMessage (const StandaloneTraceMessage &o) const

Private Member Functions

 CartesianMeshCoarsening (ICartesianMesh *m)
Int64 _getMaxUniqueId (const ItemGroup &group)
 Returns the max of uniqueId() of entities in a group.
void _recomputeMeshGenerationInfo ()
 Recalculates the information on the number of cells per direction.

Private Attributes

friend CartesianMeshImpl
ICartesianMeshm_cartesian_mesh = nullptr
Int32 m_verbosity_level = false
UniqueArray2< Int32m_refined_cells
UniqueArray< Int32m_coarse_cells
bool m_is_create_coarse_called = false
bool m_is_remove_refined_called = false
Int64 m_first_own_cell_unique_id_offset = NULL_ITEM_UNIQUE_ID

Additional Inherited Members

Protected Member Functions inherited from Arcane::TraceAccessor
void _setLocalVerboseLevel (Int32 v)
Int32 _localVerboseLevel () const

Detailed Description

Coarsens a Cartesian mesh by 2.

Deprecated
This class is obsolete. The version 2 implementation (CartesianMeshCoarsening2) must be used.

This class allows coarsening a Cartesian mesh. Instances of this class are created via ICartesianMesh::createCartesianMeshCoarsening().

The initial mesh must be Cartesian and must not have patches.

The mesh must be an AMR mesh (IMesh::isAmrActivated()==true).

The number of cells in each dimension must be a multiple of 2 as well as the number of local cells in each subdomain.

The coarsening is done in two phases:

  • createCoarseCells(), which creates the coarse cells. After calling this method, it is possible to use coarseCells() to get the list of coarse cells and refinedCells() to get for each coarse cell the list of corresponding refined cells.
  • removeRefinedCells(), which removes cells other than the coarse cells. After this call, there is only a Cartesian mesh with half the number of cells in each direction. It will then be possible to call the refinement methods to create additional levels.
ICartesianMesh* cartesian_mesh = ...;
Ref<CartesianMeshCoarsening> coarser = m_cartesian_mesh->createCartesianMeshCoarsening();
IMesh* mesh = cartesian_mesh->mesh();
CellInfoListView cells(mesh->cellFamily());
coarser->createCoarseCells();
Int32 index = 0;
for( Int32 cell_lid : coarser->coarseCells()){
Cell cell = cells[cell_lid];
info() << "Test: CoarseCell= " << ItemPrinter(cell);
ConstArrayView<Int32> sub_cells(coarser->refinedCells(index));
++index;
for( Int32 sub_lid : sub_cells )
info() << "SubCell=" << ItemPrinter(cells[sub_lid]);
}
coarser->removeRefinedCells();
View of cell information.
Cell of a mesh.
Definition Item.h:1300
Constant view of an array of type T.
virtual IMesh * mesh() const =0
Mesh associated with this Cartesian mesh.
Utility class for printing information about an entity.
Definition ItemPrinter.h:35
Reference to an instance.
TraceMessage info() const
Flow for an information message.
std::int32_t Int32
Signed integer type of 32 bits.

Definition at line 78 of file CartesianMeshCoarsening.h.

Constructor & Destructor Documentation

◆ CartesianMeshCoarsening()

Arcane::CartesianMeshCoarsening::CartesianMeshCoarsening ( ICartesianMesh * m)
explicitprivate

Definition at line 42 of file CartesianMeshCoarsening.cc.

Member Function Documentation

◆ _getMaxUniqueId()

Int64 Arcane::CartesianMeshCoarsening::_getMaxUniqueId ( const ItemGroup & group)
private

Returns the max of uniqueId() of entities in a group.

Definition at line 55 of file CartesianMeshCoarsening.cc.

References ENUMERATE_, and Arcane::Item::uniqueId().

Referenced by createCoarseCells().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _recomputeMeshGenerationInfo()

void Arcane::CartesianMeshCoarsening::_recomputeMeshGenerationInfo ( )
private

Recalculates the information on the number of cells per direction.

Definition at line 332 of file CartesianMeshCoarsening.cc.

Referenced by removeRefinedCells().

Here is the caller graph for this function:

◆ coarseCells()

ConstArrayView< Int32 > Arcane::CartesianMeshCoarsening::coarseCells ( ) const
inline

List of localIds() of coarse cells.

This method is only valid after calling createCoarseCells().

Definition at line 113 of file CartesianMeshCoarsening.h.

◆ createCoarseCells()

void Arcane::CartesianMeshCoarsening::createCoarseCells ( )

Coarsens the initial mesh by 2.

This method is collective.

List of the first child of each coarse cell

Definition at line 70 of file CartesianMeshCoarsening.cc.

References _getMaxUniqueId(), Arcane::Array< T >::add(), Arcane::MutableItemBase::addFlags(), ARCANE_FATAL, Arcane::IParallelMng::commRank(), Arcane::CartesianGridDimension::FaceUniqueIdComputer2D::computeForCell(), ENUMERATE_, Arcane::ItemBase::flags(), Arcane::CartesianGridDimension::getCellComputer2D(), Arcane::CartesianGridDimension::getFaceComputer2D(), Arcane::CartesianGridDimension::getNodeComputer2D(), Arcane::CellDirectionMng::globalNbCell(), Arcane::ItemFlags::II_UserMark1, Arcane::TraceAccessor::info(), Arcane::Item::itemBase(), Arcane::Cell::itemLocalId(), Arcane::IItemFamily::itemsUniqueIdToLocalId(), Arcane::Cell::level(), Arcane::ItemTypeInfo::localFace(), Arcane::Item::localId(), Arcane::String::localstr(), Arcane::math::max(), Arcane::Item::mutableItemBase(), Arcane::ItemTypeInfo::LocalFace::node(), Arcane::ItemWithNodes::node(), Arcane::IItemFamily::notifyItemsOwnerChanged(), Arcane::Item::owner(), Arcane::CellDirectionMng::ownNbCell(), Arcane::IParallelMng::reduce(), Arcane::MessagePassing::ReduceMax, Arcane::MutableItemBase::removeFlags(), Arcane::Array< T >::resize(), Arcane::MutableItemBase::setOwner(), Arcane::Item::typeInfo(), Arcane::Item::uniqueId(), Arcane::IItemFamily::view(), and Arcane::SimpleSVGMeshExporter::write().

Here is the call graph for this function:

◆ refinedCells()

ConstArrayView< Int32 > Arcane::CartesianMeshCoarsening::refinedCells ( Int32 index) const
inline

List of localIds() of refined cells for the parent cell at index index.

This method is only valid after calling createCoarseCells().

In 2D, there are 4 refined cells per coarse cell. In 3D, there are 8.

Definition at line 104 of file CartesianMeshCoarsening.h.

◆ removeRefinedCells()

void Arcane::CartesianMeshCoarsening::removeRefinedCells ( )

Removes refined cells.

createCoarseCells() must be called beforehand.

Definition at line 282 of file CartesianMeshCoarsening.cc.

References _recomputeMeshGenerationInfo(), Arcane::Array< T >::add(), ARCANE_FATAL, Arcane::MeshStats::dumpStats(), Arcane::IMeshModifier::endUpdate(), ENUMERATE_, Arcane::Item::isOwn(), Arcane::IMeshModifier::removeCells(), Arcane::IMeshModifier::setDynamic(), Arcane::TraceAccessor::traceMng(), and Arcane::IMeshModifier::updateGhostLayers().

Here is the call graph for this function:

Member Data Documentation

◆ CartesianMeshImpl

friend Arcane::CartesianMeshCoarsening::CartesianMeshImpl
private

Definition at line 81 of file CartesianMeshCoarsening.h.

◆ m_cartesian_mesh

ICartesianMesh* Arcane::CartesianMeshCoarsening::m_cartesian_mesh = nullptr
private

Definition at line 124 of file CartesianMeshCoarsening.h.

◆ m_coarse_cells

UniqueArray<Int32> Arcane::CartesianMeshCoarsening::m_coarse_cells
private

Definition at line 127 of file CartesianMeshCoarsening.h.

◆ m_first_own_cell_unique_id_offset

Int64 Arcane::CartesianMeshCoarsening::m_first_own_cell_unique_id_offset = NULL_ITEM_UNIQUE_ID
private

Definition at line 130 of file CartesianMeshCoarsening.h.

◆ m_is_create_coarse_called

bool Arcane::CartesianMeshCoarsening::m_is_create_coarse_called = false
private

Definition at line 128 of file CartesianMeshCoarsening.h.

◆ m_is_remove_refined_called

bool Arcane::CartesianMeshCoarsening::m_is_remove_refined_called = false
private

Definition at line 129 of file CartesianMeshCoarsening.h.

◆ m_refined_cells

UniqueArray2<Int32> Arcane::CartesianMeshCoarsening::m_refined_cells
private

Definition at line 126 of file CartesianMeshCoarsening.h.

◆ m_verbosity_level

Int32 Arcane::CartesianMeshCoarsening::m_verbosity_level = false
private

Definition at line 125 of file CartesianMeshCoarsening.h.


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