1 #ifndef DUNE_ALUGRID_COMMON_DECLARATION_HH 2 #define DUNE_ALUGRID_COMMON_DECLARATION_HH 3 4 #define ALU3DGRID_PARALLEL HAVE_MPI 5 6 #include <dune/common/parallel/communication.hh> 7 #if ALU3DGRID_PARALLEL 8 #include <dune/common/parallel/mpicommunication.hh> 9 #endif // #if ALU3DGRID_PARALLEL 10 11 12 namespace Dune 13 { 14 15 //! \brief basic element types for ALUGrid 16 enum ALUGridElementType 17 { 18 simplex, //!< use only simplex elements (i.e., triangles or tetrahedra) 19 cube //!< use only cube elements (i.e., quadrilaterals or hexahedra) 20 }; 21 22 //! \brief available refinement types for ALUGrid 23 enum ALUGridRefinementType 24 { 25 conforming, //!< use conforming bisection refinement 26 nonconforming //!< use non-conforming (red) refinement 27 }; 28 29 //! \brief type of class for specialization of serial ALUGrid (No_Comm as communicator) 30 struct ALUGridNoComm 31 { 32 No_Comm noComm_; ALUGridNoCommDune::ALUGridNoComm33 ALUGridNoComm() : noComm_() {} ALUGridNoCommDune::ALUGridNoComm34 ALUGridNoComm( const No_Comm& comm ) : noComm_( comm ) {} 35 #if ALU3DGRID_PARALLEL ALUGridNoCommDune::ALUGridNoComm36 ALUGridNoComm( MPI_Comm comm ) : noComm_() {} operator MPI_CommDune::ALUGridNoComm37 operator MPI_Comm () const { return MPI_COMM_SELF; } 38 #endif operator No_CommDune::ALUGridNoComm39 operator No_Comm () const { return noComm_; } 40 }; 41 42 //! \brief type of class for specialization of parallel ALUGrid (MPI_Comm as communicator) 43 struct ALUGridMPIComm { 44 #if ALU3DGRID_PARALLEL 45 MPI_Comm mpiComm_; ALUGridMPICommDune::ALUGridMPIComm46 ALUGridMPIComm() : mpiComm_( MPI_COMM_WORLD ) {} ALUGridMPICommDune::ALUGridMPIComm47 ALUGridMPIComm( MPI_Comm comm ) : mpiComm_( comm ) {} operator MPI_CommDune::ALUGridMPIComm48 operator MPI_Comm () const { return mpiComm_; } 49 #endif 50 } ; 51 52 /** 53 * \brief unstructured parallel implementation of the DUNE grid interface 54 * 55 * %ALUGrid implements the DUNE grid interface for 2D quadrilateral and 3D 56 * hexahedral as well as 2D triangular and 3D tetrahedral meshes. 57 * This grid can be locally adapted (non-conforming and conforming bisection) 58 * and used in parallel computations using dynamic load balancing. 59 * 60 * \tparam dim dimension of the grid (2 or 3) 61 * \tparam dimworld dimension of the surrounding space (dim <= dimworld <=3) 62 * \tparam elType type of elements (Dune::simplex or Dune::cube) 63 * \tparam refineType type of refinement (Dune::conforming or Dune::nonconforming) 64 * \tparam Comm type of communicator (Dune::ALUGridMPIComm or Dune::ALUGridNoComm) 65 * 66 * \note For cube elements, only nonconforming refinement is available. 67 * \note The template parameter Comm defaults to ALUGridMPIComm, if MPI is available. 68 * Otherwise it defaults to ALUGridNoComm. 69 */ 70 template <int dim, int dimworld, ALUGridElementType elType, ALUGridRefinementType refineType, 71 class Comm = 72 #if ALU3DGRID_PARALLEL 73 ALUGridMPIComm 74 #else 75 ALUGridNoComm 76 #endif 77 > 78 class ALUGrid; 79 80 //- traits class for declaring base class for ALUGrid 81 template <int dim, int dimw, ALUGridElementType elType, class Comm > 82 struct ALUGridBaseGrid ; 83 } 84 #endif // #ifndef DUNE_ALUGRID_COMMON_DECLARATION_HH 85