MFEM v2.0
|
00001 // Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at 00002 // the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights 00003 // reserved. See file COPYRIGHT for details. 00004 // 00005 // This file is part of the MFEM library. For more information and source code 00006 // availability see http://mfem.googlecode.com. 00007 // 00008 // MFEM is free software; you can redistribute it and/or modify it under the 00009 // terms of the GNU Lesser General Public License (as published by the Free 00010 // Software Foundation) version 2.1 dated February 1999. 00011 00012 #ifndef MFEM_PMESH 00013 #define MFEM_PMESH 00014 00016 class ParMesh : public Mesh 00017 { 00018 private: 00019 MPI_Comm MyComm; 00020 int NRanks, MyRank; 00021 00022 Array<Element *> shared_edges; 00023 Array<Element *> shared_faces; 00024 00026 Table group_svert; 00027 Table group_sedge; 00028 Table group_sface; 00029 00031 Array<int> svert_lvert; 00032 Array<int> sedge_ledge; 00033 Array<int> sface_lface; 00034 00036 int GetEdgeSplittings(Element *edge, const DSTable &v_to_v, int *middle); 00038 int GetFaceSplittings(Element *face, const DSTable &v_to_v, int *middle); 00039 00041 virtual void QuadUniformRefinement(); 00042 00044 virtual void HexUniformRefinement(); 00045 00046 virtual void NURBSUniformRefinement(); 00047 00048 public: 00049 ParMesh(MPI_Comm comm, Mesh &mesh, int *partitioning_ = NULL, 00050 int part_method = 1); 00051 00052 MPI_Comm GetComm() { return MyComm; } 00053 int GetNRanks() { return NRanks; } 00054 int GetMyRank() { return MyRank; } 00055 00056 GroupTopology gtopo; 00057 00058 int GetNGroups() { return gtopo.NGroups(); } 00059 00060 // next 6 methods do not work for the 'local' group 0 00061 int GroupNVertices(int group) { return group_svert.RowSize(group-1); } 00062 int GroupNEdges(int group) { return group_sedge.RowSize(group-1); } 00063 int GroupNFaces(int group) { return group_sface.RowSize(group-1); } 00064 00065 int GroupVertex(int group, int i) 00066 { return svert_lvert[group_svert.GetJ()[group_svert.GetI()[group-1]+i]]; } 00067 void GroupEdge(int group, int i, int &edge, int &o); 00068 void GroupFace(int group, int i, int &face, int &o); 00069 00071 virtual void ReorientTetMesh(); 00072 00074 virtual void LocalRefinement(const Array<int> &marked_el, int type = 3); 00075 00077 void RefineGroups(const DSTable &v_to_v, int *middle); 00078 00081 virtual void Print(ostream &out = cout) const; 00082 00085 virtual void PrintXG(ostream &out = cout) const; 00086 00092 void PrintAsOne(ostream &out = cout); 00093 00095 void PrintAsOneXG(ostream &out = cout); 00096 00098 void PrintInfo(ostream &out = cout); 00099 00100 virtual ~ParMesh(); 00101 }; 00102 00103 #endif