00001 /* @HEADER@ */ 00002 // ************************************************************************ 00003 // 00004 // Sundance 00005 // Copyright (2005) Sandia Corporation 00006 // 00007 // Copyright (year first published) Sandia Corporation. Under the terms 00008 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government 00009 // retains certain rights in this software. 00010 // 00011 // This library is free software; you can redistribute it and/or modify 00012 // it under the terms of the GNU Lesser General Public License as 00013 // published by the Free Software Foundation; either version 2.1 of the 00014 // License, or (at your option) any later version. 00015 // 00016 // This library is distributed in the hope that it will be useful, but 00017 // WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 // Lesser General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU Lesser General Public 00022 // License along with this library; if not, write to the Free Software 00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00024 // USA 00025 // Questions? Contact Kevin Long (krlong@sandia.gov), 00026 // Sandia National Laboratories, Livermore, California, USA 00027 // 00028 // ************************************************************************ 00029 /* @HEADER@ */ 00030 /* 00031 * SundancePeanoMesh3D.h 00032 * 00033 * Created on: Sep 8, 2009 00034 * Author: benk 00035 */ 00036 00037 #ifndef SUNDANCEPEANOMESH3D_H_ 00038 #define SUNDANCEPEANOMESH3D_H_ 00039 00040 #include "SundanceDefs.hpp" 00041 #include "SundanceMeshBase.hpp" 00042 #include "SundanceSet.hpp" 00043 #include "SundancePoint.hpp" 00044 #include "SundanceCellType.hpp" 00045 00046 #ifdef HAVE_SUNDANCE_PEANO 00047 00048 #include "SundancePeanoInterface3D.h" 00049 00050 namespace Sundance 00051 { 00052 class PeanoMesh3D : public MeshBase{ 00053 public: 00054 00055 /** 00056 * The constuctor for the Peano grid*/ 00057 PeanoMesh3D(int dim, 00058 const MPIComm& comm, 00059 const MeshEntityOrder& order); 00060 00061 /** 00062 * The constuctor for the Peano grid in 3D*/ 00063 void createMesh( 00064 double position_x, 00065 double position_y, 00066 double position_z, 00067 double offset_x, 00068 double offset_y, 00069 double offset_z, 00070 double resolution); 00071 00072 virtual ~PeanoMesh3D(); 00073 00074 /** 00075 * Get the number of cells having dimension dim 00076 */ 00077 virtual int numCells(int dim) const; 00078 00079 /** 00080 * Return the position of the i-th node 00081 */ 00082 virtual Point nodePosition(int i) const; 00083 00084 /** 00085 * Return a view of the i-th node's position 00086 */ 00087 const double* nodePositionView(int i) const; 00088 00089 00090 00091 /** 00092 * Compute the jacobians of a batch of cells, returning the 00093 * result via reference argument 00094 * 00095 * @param cellDim dimension of the cells whose Jacobians are to 00096 * be computed 00097 * @param cellLID local indices of the cells for which Jacobians 00098 * are to be computed 00099 * @param jBatch reference to the resulting Jacobian batch 00100 */ 00101 virtual void getJacobians(int cellDim, const Array<int>& cellLID, 00102 CellJacobianBatch& jBatch) const; 00103 00104 /** 00105 * Compute the diameters of a batch of cells, 00106 * result via reference argument 00107 * 00108 * @param cellDim dimension of the cells whose diameters are to 00109 * be computed 00110 * @param cellLID local indices of the cells for which diameters 00111 * are to be computed 00112 * @param diameters reference to the array of cell diameters 00113 */ 00114 virtual void getCellDiameters(int cellDim, const Array<int>& cellLID, 00115 Array<double>& cellDiameters) const; 00116 00117 00118 /** 00119 * Map reference quadrature points to physical points on the 00120 * given cells. 00121 */ 00122 virtual void pushForward(int cellDim, const Array<int>& cellLID, 00123 const Array<Point>& refQuadPts, 00124 Array<Point>& physQuadPts) const; 00125 00126 /** 00127 * Return the rank of the processor that owns the given cell 00128 */ 00129 virtual int ownerProcID(int cellDim, int cellLID) const; 00130 00131 /** 00132 * Return the number of facets of the given cell 00133 */ 00134 virtual int numFacets(int cellDim, int cellLID, 00135 int facetDim) const; 00136 00137 /** 00138 * Return the local ID of a facet cell 00139 * @param cellDim dimension of the cell whose facets are being obtained 00140 * @param cellLID local index of the cell whose 00141 * facets are being obtained 00142 * @param facetDim dimension of the desired facet 00143 * @param facetIndex index into the list of the cell's facets 00144 * @param facetOrientation orientation of the facet as seen from 00145 * the given cell (returned via reference) 00146 */ 00147 virtual int facetLID(int cellDim, int cellLID, 00148 int facetDim, int facetIndex, 00149 int& facetOrientation) const; 00150 00151 /** 00152 * Return by reference argument an array containing&(elemVerts_.value(cellLID, 0)) 00153 * the LIDs of the facetDim-dimensional facets of the 00154 * given batch of cells 00155 */ 00156 virtual void getFacetLIDs(int cellDim, 00157 const Array<int>& cellLID, 00158 int facetDim, 00159 Array<int>& facetLID, 00160 Array<int>& facetSign) const; 00161 00162 /** 00163 * Return a view of an element's zero-dimensional facets, 00164 * @return an array of integers with the indexes of the points which for it 00165 */ 00166 const int* elemZeroFacetView(int cellLID) const; 00167 00168 /** 00169 * Return the number of maximal cofacets of the given cell 00170 */ 00171 virtual int numMaxCofacets(int cellDim, int cellLID) const; 00172 00173 /** 00174 * Return the local ID of a maximal cofacet cell 00175 * @param cellDim dimension of the cell whose cofacets are being obtained 00176 * @param cellLID local index of the cell whose 00177 * cofacets are being obtained 00178 * @param cofacetIndex which maximal cofacet to get 00179 * @param facetIndex index of the cell cellLID into the list of the 00180 * maximal cell's facets 00181 */ 00182 virtual int maxCofacetLID(int cellDim, int cellLID, 00183 int cofacetIndex, 00184 int& facetIndex) const; 00185 /** 00186 * Get the LIDs of the maximal cofacets for a batch of codimension-one 00187 * cells. 00188 * 00189 * \param cellLIDs [in] array of LIDs of the cells whose cofacets are 00190 * being obtained 00191 * \param cofacets [out] the batch of cofacets 00192 */ 00193 virtual void getMaxCofacetLIDs(const Array<int>& cellLIDs, 00194 MaximalCofacetBatch& cofacets) const; 00195 00196 00197 /** 00198 * Find the cofacets of the given cell 00199 * @param cellDim dimension of the cell whose cofacets are being obtained 00200 * @param cellLID local index of the cell whose 00201 * cofacets are being obtained 00202 * @param cofacetDim dimension of the cofacets to get 00203 * @param cofacetLIDs LIDs of the cofacet 00204 */ 00205 void getCofacets(int cellDim, int cellLID, 00206 int cofacetDim, Array<int>& cofacetLIDs) const; 00207 00208 /** 00209 * Find the local ID of a cell given its global index 00210 */ 00211 virtual int mapGIDToLID(int cellDim, int globalIndex) const; 00212 00213 /** 00214 * Determine whether a given cell GID exists on this processor 00215 */ 00216 virtual bool hasGID(int cellDim, int globalIndex) const; 00217 00218 00219 /** 00220 * Find the global ID of a cell given its local index 00221 */ 00222 virtual int mapLIDToGID(int cellDim, int localIndex) const; 00223 00224 /** 00225 * Get the type of the given cell 00226 */ 00227 virtual CellType cellType(int cellDim) const; 00228 00229 00230 /** Get the label of the given cell */ 00231 virtual int label(int cellDim, int cellLID) const; 00232 00233 /** Get the labels for a batch of cells */ 00234 virtual void getLabels(int cellDim, const Array<int>& cellLID, 00235 Array<int>& labels) const; 00236 00237 00238 00239 /** Get the list of all labels defined for cells of the given dimension */ 00240 virtual Set<int> getAllLabelsForDimension(int cellDim) const; 00241 00242 /** 00243 * Get the cells associated with a specified label. The array 00244 * cellLID will be filled with those cells of dimension cellDim 00245 * having the given label. 00246 */ 00247 virtual void getLIDsForLabel(int cellDim, int label, Array<int>& cellLIDs) const; 00248 00249 00250 /** Set the label of the given cell */ 00251 virtual void setLabel(int cellDim, int cellLID, int label); 00252 00253 /** Coordinate intermediate cell definitions across processors */ 00254 virtual void assignIntermediateCellGIDs(int cellDim); 00255 00256 /** */ 00257 virtual bool hasIntermediateGIDs(int dim) const; 00258 00259 00260 private: 00261 00262 /** The dimension of the grid*/ 00263 int _dimension; 00264 00265 /** The communicator */ 00266 const MPIComm& _comm; 00267 00268 /** This pointer is the pointer to the 3 dimensional Peano mesh*/ 00269 SundancePeanoInterface3D *_peanoMesh; 00270 00271 /** The unique resolution in each dimension */ 00272 double _uniqueResolution; 00273 00274 /** The Point which is used as a returned argument in 3D*/ 00275 static Point returnPoint; 00276 00277 }; 00278 } 00279 #endif 00280 00281 #endif /* SUNDANCEPEANOMESH3D_H_ */