1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef __BLOCKTOPOLOGY_HXX__
21 #define __BLOCKTOPOLOGY_HXX__
23 #include "Topology.hxx"
24 #include "ProcessorGroup.hxx"
30 class ComponentTopology;
31 class MEDCouplingCMesh;
33 typedef enum{Block,Cycle} CYCLE_TYPE;
35 class BlockTopology : public Topology
39 BlockTopology(const ProcessorGroup& group, MEDCouplingCMesh *grid);
40 BlockTopology(const BlockTopology& geom_topo, const ComponentTopology& comp_topo);
41 BlockTopology(const ProcessorGroup& group, int nb_elem);
42 virtual ~BlockTopology();
43 //!Retrieves the number of elements for a given topology
44 int getNbElements()const { return _nb_elems; }
45 int getNbLocalElements() const;
46 const ProcessorGroup* getProcGroup()const { return _proc_group; }
47 std::pair<int,int> globalToLocal (const int) const ;
48 int localToGlobal (const std::pair<int,int>) const;
49 std::vector<std::pair<int,int> > getLocalArrayMinMax() const ;
50 int getDimension() const { return _dimension; }
51 void serialize(int* & serializer, int& size) const ;
52 void unserialize(const int* serializer, const CommInterface& comm_interface);
57 std::vector<int> _nb_procs_per_dim;
58 //stores the offsets vector
59 std::vector<std::vector<int> > _local_array_indices;
60 //stores the cycle type (block or cyclic)
61 std::vector<CYCLE_TYPE> _cycle_type;
63 const ProcessorGroup* _proc_group;
66 bool _owns_processor_group;