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 __EXPLICITTOPOLOGY_HXX__
20 #define __EXPLICITTOPOLOGY_HXX__
22 #include "ProcessorGroup.hxx"
27 #include <ext/hash_map>
33 class ComponentTopology;
35 class ExplicitTopology : public Topology
38 ExplicitTopology() { }
39 ExplicitTopology( const ExplicitTopology& topo, int nbcomponents);
40 ExplicitTopology(const ParaMESH &mesh);
41 virtual ~ExplicitTopology();
43 inline int getNbElements()const;
44 inline int getNbLocalElements() const;
45 const ProcessorGroup* getProcGroup()const { return _proc_group; }
46 int localToGlobal (const std::pair<int,int> local) const { return localToGlobal(local.second); }
47 inline int localToGlobal(int) const;
48 inline int globalToLocal(int) const;
49 void serialize(int* & serializer, int& size) const ;
50 void unserialize(const int* serializer, const CommInterface& comm_interface);
51 int getNbComponents() const { return _nb_components; }
54 const ProcessorGroup* _proc_group;
59 //mapping local to global
61 //mapping global to local
62 __gnu_cxx::hash_map<int,int> _glob2loc;
65 //!converts a pair <subdomainid,local> to a global number
66 inline int ExplicitTopology::globalToLocal(const int global) const
68 return (_glob2loc.find(global))->second;;
71 //!converts local number to a global number
72 int ExplicitTopology::localToGlobal(int local) const
74 return _loc2glob[local];
77 //!Retrieves the number of elements for a given topology
78 inline int ExplicitTopology::getNbElements() const
83 //Retrieves the local number of elements
84 inline int ExplicitTopology::getNbLocalElements()const
86 return _glob2loc.size();