1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 // vi: set et ts=4 sw=2 sts=2: 3 #ifndef DUNE_GRID_COMMON_GRIDENUMS_HH 4 #define DUNE_GRID_COMMON_GRIDENUMS_HH 5 6 #include <iostream> 7 8 #include <dune/common/exceptions.hh> 9 10 namespace Dune { 11 12 /** 13 * \addtogroup gridpartitions Parallel Grid Partitions 14 * \{ 15 */ 16 17 /** \brief Attributes used in the generic overlap model 18 * 19 \code 20 #include <dune/grid/common/gridenums.hh> 21 \endcode 22 * 23 * The values are ordered intentionally in order to be able to 24 * define ranges of partition types. 25 * 26 * @ingroup GIRelatedTypes 27 */ 28 enum PartitionType { 29 InteriorEntity=0, //!< all interior entities 30 BorderEntity=1 , //!< on boundary between interior and overlap 31 OverlapEntity=2 , //!< all entities lying in the overlap zone 32 FrontEntity=3 , //!< on boundary between overlap and ghost 33 GhostEntity=4 //!< ghost entities 34 }; 35 36 /** \brief Provide names for the partition types 37 * 38 \code 39 #include <dune/grid/common/gridenums.hh> 40 \endcode 41 * 42 * @ingroup GIRelatedTypes 43 */ PartitionName(PartitionType type)44 inline std::string PartitionName(PartitionType type) 45 { 46 switch(type) { 47 case InteriorEntity : 48 return "interior"; 49 case BorderEntity : 50 return "border"; 51 case OverlapEntity : 52 return "overlap"; 53 case FrontEntity : 54 return "front"; 55 case GhostEntity : 56 return "ghost"; 57 default : 58 DUNE_THROW(NotImplemented, "name of unknown partition type requested"); 59 } 60 } 61 62 //! write a PartitionType to a stream 63 /** 64 \code 65 #include <dune/grid/common/gridenums.hh> 66 \endcode 67 * 68 * @ingroup GIRelatedTypes 69 */ operator <<(std::ostream & out,const PartitionType & type)70 inline std::ostream &operator<< ( std::ostream &out, const PartitionType &type ) 71 { 72 return out << PartitionName( type ); 73 } 74 75 76 /** \brief Parameter to be used for the communication functions 77 * 78 \code 79 #include <dune/grid/common/gridenums.hh> 80 \endcode 81 * 82 * @ingroup GIRelatedTypes 83 */ 84 enum InterfaceType { 85 InteriorBorder_InteriorBorder_Interface=0, //!< send/receive interior and border entities 86 InteriorBorder_All_Interface=1, //!< send interior and border, receive all entities 87 Overlap_OverlapFront_Interface=2, //!< send overlap, receive overlap and front entities 88 Overlap_All_Interface=3, //!< send overlap, receive all entities 89 All_All_Interface=4 //!< send all and receive all entities 90 }; 91 92 93 //! write an InterfaceType to a stream 94 /** 95 \code 96 #include <dune/grid/common/gridenums.hh> 97 \endcode 98 * 99 * @ingroup GIRelatedTypes 100 */ operator <<(std::ostream & out,const InterfaceType & type)101 inline std::ostream &operator<< ( std::ostream &out, const InterfaceType &type ) 102 { 103 switch( type ) 104 { 105 case InteriorBorder_InteriorBorder_Interface : 106 return out << "interior-border / interior-border interface"; 107 108 case InteriorBorder_All_Interface : 109 return out << "interior-border / all interface"; 110 111 case Overlap_OverlapFront_Interface : 112 return out << "overlap / overlap-front interface"; 113 114 case Overlap_All_Interface : 115 return out << "overlap / all interface"; 116 117 case All_All_Interface : 118 return out << "all / all interface"; 119 120 default : 121 return out << "unknown interface"; 122 } 123 } 124 125 126 /** \brief Parameter to be used for the parallel level- and leaf iterators 127 * 128 \code 129 #include <dune/grid/common/gridenums.hh> 130 \endcode 131 * 132 * @ingroup GIRelatedTypes 133 */ 134 enum PartitionIteratorType { 135 Interior_Partition=0, //!< only interior entities 136 InteriorBorder_Partition=1, //!< interior and border entities 137 Overlap_Partition=2, //!< interior, border, and overlap entities 138 OverlapFront_Partition=3, //!< interior, border, overlap and front entities 139 All_Partition=4, //!< all entities 140 Ghost_Partition=5 //!< only ghost entities 141 }; 142 143 144 //! write a PartitionIteratorType to a stream 145 /** 146 \code 147 #include <dune/grid/common/gridenums.hh> 148 \endcode 149 * 150 * @ingroup GIRelatedTypes 151 */ operator <<(std::ostream & out,const PartitionIteratorType & type)152 inline std::ostream &operator<< ( std::ostream &out, const PartitionIteratorType &type ) 153 { 154 static std::string name[ 6 ] = { "interior partition", "interior-border partition", "overlap partition", 155 "overlap-front partition", "all partition", "ghost partition" }; 156 return out << name[ type ]; 157 } 158 159 160 /** \brief Define a type for communication direction parameter 161 * 162 \code 163 #include <dune/grid/common/gridenums.hh> 164 \endcode 165 * 166 * @ingroup GIRelatedTypes 167 */ 168 enum CommunicationDirection { 169 ForwardCommunication, //!< communicate as given in InterfaceType 170 BackwardCommunication //!< reverse communication direction 171 }; 172 173 /** 174 * \} 175 */ 176 177 178 } 179 #endif 180