1 // Copyright (C) 2007-2008 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
19 #ifndef __BLOCKTOPOLOGY_HXX__
20 #define __BLOCKTOPOLOGY_HXX__
22 #include "Topology.hxx"
23 #include "ProcessorGroup.hxx"
29 class ComponentTopology;
30 class MEDCouplingSMesh;
32 typedef enum{Block,Cycle} CYCLE_TYPE;
34 class BlockTopology : public Topology
38 BlockTopology(const ProcessorGroup& group, MEDCouplingSMesh *grid);
39 BlockTopology(const BlockTopology& geom_topo, const ComponentTopology& comp_topo);
40 BlockTopology(const ProcessorGroup& group, int nb_elem);
41 virtual ~BlockTopology();
42 //!Retrieves the number of elements for a given topology
43 int getNbElements()const { return _nb_elems; }
44 int getNbLocalElements() const;
45 const ProcessorGroup* getProcGroup()const { return _proc_group; }
46 std::pair<int,int> globalToLocal (const int) const ;
47 int localToGlobal (const std::pair<int,int>) const;
48 std::vector<std::pair<int,int> > getLocalArrayMinMax() const ;
49 int getDimension() const { return _dimension; }
50 void serialize(int* & serializer, int& size) const ;
51 void unserialize(const int* serializer, const CommInterface& comm_interface);
56 std::vector<int> _nb_procs_per_dim;
57 //stores the offsets vector
58 std::vector<std::vector<int> > _local_array_indices;
59 //stores the cycle type (block or cyclic)
60 std::vector<CYCLE_TYPE> _cycle_type;
62 const ProcessorGroup* _proc_group;
65 bool _owns_processor_group;