-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2024 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <vector>
-namespace ParaMEDMEM
+namespace MEDCoupling
{
class ComponentTopology;
class MEDCouplingCMesh;
typedef enum{Block,Cycle} CYCLE_TYPE;
+ /*!
+ * \anchor BlockTopology-det
+ *
+ * A BlockTopology typically represents the split of a *structured* mesh among the processors of
+ * a common ProcessorGroup. Each processor gets a contiguous part of the cells in the mesh (a block).
+ *
+ * A BlockTopology can also be used to split a structured domain among the various components of a field.
+ *
+ * \sa ExplicitTopology
+ */
class BlockTopology : public Topology
{
public:
- BlockTopology() { }
+ BlockTopology();
BlockTopology(const ProcessorGroup& group, MEDCouplingCMesh *grid);
BlockTopology(const BlockTopology& geom_topo, const ComponentTopology& comp_topo);
- BlockTopology(const ProcessorGroup& group, int nb_elem);
+ BlockTopology(const ProcessorGroup& group, mcIdType nb_elem);
virtual ~BlockTopology();
+ void release();
+
//!Retrieves the number of elements for a given topology
- int getNbElements()const { return _nb_elems; }
- int getNbLocalElements() const;
+ mcIdType getNbElements()const { return _nb_elems; }
+ mcIdType getNbLocalElements() const;
const ProcessorGroup* getProcGroup()const { return _proc_group; }
- std::pair<int,int> globalToLocal (const int) const ;
- int localToGlobal (const std::pair<int,int>) const;
- std::vector<std::pair<int,int> > getLocalArrayMinMax() const ;
+ std::pair<int,mcIdType> globalToLocal (const mcIdType) const ;
+ mcIdType localToGlobal (const std::pair<int,mcIdType>) const;
+ std::vector<std::pair<int,mcIdType> > getLocalArrayMinMax() const ;
int getDimension() const { return _dimension; }
- void serialize(int* & serializer, int& size) const ;
- void unserialize(const int* serializer, const CommInterface& comm_interface);
+ void serialize(mcIdType* & serializer, mcIdType& size) const ;
+ void unserialize(const mcIdType* serializer, const CommInterface& comm_interface);
private:
//dimension : 2 or 3
int _dimension;
//proc array
std::vector<int> _nb_procs_per_dim;
//stores the offsets vector
- std::vector<std::vector<int> > _local_array_indices;
+ std::vector<std::vector<mcIdType> > _local_array_indices;
//stores the cycle type (block or cyclic)
std::vector<CYCLE_TYPE> _cycle_type;
//Processor group
const ProcessorGroup* _proc_group;
//nb of elements
- int _nb_elems;
+ mcIdType _nb_elems;
bool _owns_processor_group;
};
}