00001 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D 00002 // 00003 // This library is free software; you can redistribute it and/or 00004 // modify it under the terms of the GNU Lesser General Public 00005 // License as published by the Free Software Foundation; either 00006 // version 2.1 of the License. 00007 // 00008 // This library is distributed in the hope that it will be useful, 00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 // Lesser General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU Lesser General Public 00014 // License along with this library; if not, write to the Free Software 00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00016 // 00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com 00018 // 00019 00020 #ifndef __BLOCKTOPOLOGY_HXX__ 00021 #define __BLOCKTOPOLOGY_HXX__ 00022 00023 #include "Topology.hxx" 00024 #include "ProcessorGroup.hxx" 00025 00026 #include <vector> 00027 00028 namespace ParaMEDMEM 00029 { 00030 class ComponentTopology; 00031 class MEDCouplingCMesh; 00032 00033 typedef enum{Block,Cycle} CYCLE_TYPE; 00034 00035 class BlockTopology : public Topology 00036 { 00037 public: 00038 BlockTopology() { } 00039 BlockTopology(const ProcessorGroup& group, MEDCouplingCMesh *grid); 00040 BlockTopology(const BlockTopology& geom_topo, const ComponentTopology& comp_topo); 00041 BlockTopology(const ProcessorGroup& group, int nb_elem); 00042 virtual ~BlockTopology(); 00044 int getNbElements()const { return _nb_elems; } 00045 int getNbLocalElements() const; 00046 const ProcessorGroup* getProcGroup()const { return _proc_group; } 00047 std::pair<int,int> globalToLocal (const int) const ; 00048 int localToGlobal (const std::pair<int,int>) const; 00049 std::vector<std::pair<int,int> > getLocalArrayMinMax() const ; 00050 int getDimension() const { return _dimension; } 00051 void serialize(int* & serializer, int& size) const ; 00052 void unserialize(const int* serializer, const CommInterface& comm_interface); 00053 private: 00054 //dimension : 2 or 3 00055 int _dimension; 00056 //proc array 00057 std::vector<int> _nb_procs_per_dim; 00058 //stores the offsets vector 00059 std::vector<std::vector<int> > _local_array_indices; 00060 //stores the cycle type (block or cyclic) 00061 std::vector<CYCLE_TYPE> _cycle_type; 00062 //Processor group 00063 const ProcessorGroup* _proc_group; 00064 //nb of elements 00065 int _nb_elems; 00066 bool _owns_processor_group; 00067 }; 00068 } 00069 00070 #endif