SundancePeanoMesh3D.hpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 // ************************************************************************
00003 // 
00004 //                             Sundance
00005 //                 Copyright 2011 Sandia Corporation
00006 // 
00007 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00008 // the U.S. Government retains certain rights in this software.
00009 //
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Kevin Long (kevin.long@ttu.edu)
00038 // 
00039 
00040 /* @HEADER@ */
00041 /*
00042  * SundancePeanoMesh3D.h
00043  *
00044  *  Created on: Sep 8, 2009
00045  *      Author: benk
00046  */
00047 
00048 #ifndef SUNDANCEPEANOMESH3D_H_
00049 #define SUNDANCEPEANOMESH3D_H_
00050 
00051 #include "SundanceDefs.hpp"
00052 #include "SundanceMeshBase.hpp"
00053 #include "SundanceSet.hpp"
00054 #include "SundancePoint.hpp"
00055 #include "SundanceCellType.hpp"
00056 
00057 #ifdef HAVE_SUNDANCE_PEANO
00058 
00059 #include "SundancePeanoInterface3D.h"
00060 
00061 namespace Sundance
00062 {
00063   class PeanoMesh3D : public MeshBase{
00064   public:
00065 
00066   /**
00067    * The constuctor for the Peano grid*/
00068     PeanoMesh3D(int dim,
00069           const MPIComm& comm,
00070           const MeshEntityOrder& order);
00071 
00072     /**
00073      * The constuctor for the Peano grid in 3D*/
00074   void createMesh(
00075         double position_x,
00076         double position_y,
00077         double position_z,
00078         double offset_x,
00079         double offset_y,
00080         double offset_z,
00081         double resolution);
00082 
00083   virtual ~PeanoMesh3D();
00084 
00085     /**
00086      * Get the number of cells having dimension dim
00087      */
00088     virtual int numCells(int dim) const;
00089 
00090     /**
00091      * Return the position of the i-th node
00092      */
00093     virtual Point nodePosition(int i) const;
00094 
00095     /**
00096      * Return a view of the i-th node's position
00097      */
00098     const double* nodePositionView(int i) const;
00099 
00100 
00101 
00102     /**
00103      * Compute the jacobians of a batch of cells, returning the
00104      * result via reference argument
00105      *
00106      * @param cellDim dimension of the cells whose Jacobians are to
00107      * be computed
00108      * @param cellLID local indices of the cells for which Jacobians
00109      * are to be computed
00110      * @param jBatch reference to the resulting Jacobian batch
00111      */
00112     virtual void getJacobians(int cellDim, const Array<int>& cellLID,
00113                               CellJacobianBatch& jBatch) const;
00114 
00115     /**
00116      * Compute the diameters of a batch of cells,
00117      * result via reference argument
00118      *
00119      * @param cellDim dimension of the cells whose diameters are to
00120      * be computed
00121      * @param cellLID local indices of the cells for which diameters
00122      * are to be computed
00123      * @param diameters reference to the array of cell diameters
00124      */
00125     virtual void getCellDiameters(int cellDim, const Array<int>& cellLID,
00126                                   Array<double>& cellDiameters) const;
00127 
00128 
00129     /**
00130      * Map reference quadrature points to physical points on the
00131      * given cells.
00132      */
00133     virtual void pushForward(int cellDim, const Array<int>& cellLID,
00134                              const Array<Point>& refQuadPts,
00135                              Array<Point>& physQuadPts) const;
00136 
00137     /**
00138      * Return the rank of the processor that owns the given cell
00139      */
00140     virtual int ownerProcID(int cellDim, int cellLID) const;
00141 
00142     /**
00143      * Return the number of facets of the given cell
00144      */
00145     virtual int numFacets(int cellDim, int cellLID,
00146                           int facetDim) const;
00147 
00148     /**
00149      * Return the local ID of a facet cell
00150      * @param cellDim dimension of the cell whose facets are being obtained
00151      * @param cellLID local index of the cell whose
00152      * facets are being obtained
00153      * @param facetDim dimension of the desired facet
00154      * @param facetIndex index into the list of the cell's facets
00155      * @param facetOrientation orientation of the facet as seen from
00156      * the given cell (returned via reference)
00157      */
00158     virtual int facetLID(int cellDim, int cellLID,
00159                          int facetDim, int facetIndex,
00160                          int& facetOrientation) const;
00161 
00162     /**
00163      * Return by reference argument an array containing&(elemVerts_.value(cellLID, 0))
00164      * the LIDs of the facetDim-dimensional facets of the
00165      * given batch of cells
00166      */
00167     virtual void getFacetLIDs(int cellDim,
00168                               const Array<int>& cellLID,
00169                               int facetDim,
00170                               Array<int>& facetLID,
00171                               Array<int>& facetSign) const;
00172 
00173     /**
00174      * Return a view of an element's zero-dimensional facets,
00175      * @return an array of integers with the indexes of the points which for it
00176      */
00177     const int* elemZeroFacetView(int cellLID) const;
00178 
00179     /**
00180      * Return the number of maximal cofacets of the given cell
00181      */
00182     virtual int numMaxCofacets(int cellDim, int cellLID) const;
00183 
00184     /**
00185      * Return the local ID of a maximal cofacet cell
00186      * @param cellDim dimension of the cell whose cofacets are being obtained
00187      * @param cellLID local index of the cell whose
00188      * cofacets are being obtained
00189      * @param cofacetIndex which maximal cofacet to get
00190      * @param facetIndex index of the cell cellLID into the list of the
00191      * maximal cell's facets
00192      */
00193     virtual int maxCofacetLID(int cellDim, int cellLID,
00194                            int cofacetIndex,
00195                            int& facetIndex) const;
00196   /**
00197    * Get the LIDs of the maximal cofacets for a batch of codimension-one
00198    * cells.
00199    *
00200    * \param cellLIDs [in] array of LIDs of the cells whose cofacets are
00201    * being obtained
00202    * \param cofacets [out] the batch of cofacets
00203    */
00204     virtual void getMaxCofacetLIDs(const Array<int>& cellLIDs,
00205       MaximalCofacetBatch& cofacets) const;
00206 
00207 
00208     /**
00209      * Find the cofacets of the given cell
00210      * @param cellDim dimension of the cell whose cofacets are being obtained
00211      * @param cellLID local index of the cell whose
00212      * cofacets are being obtained
00213      * @param cofacetDim dimension of the cofacets to get
00214      * @param cofacetLIDs LIDs of the cofacet
00215      */
00216     void getCofacets(int cellDim, int cellLID,
00217                      int cofacetDim, Array<int>& cofacetLIDs) const;
00218 
00219     /**
00220      * Find the local ID of a cell given its global index
00221      */
00222     virtual int mapGIDToLID(int cellDim, int globalIndex) const;
00223 
00224     /**
00225      * Determine whether a given cell GID exists on this processor
00226      */
00227     virtual bool hasGID(int cellDim, int globalIndex) const;
00228 
00229 
00230     /**
00231      * Find the global ID of a cell given its local index
00232      */
00233     virtual int mapLIDToGID(int cellDim, int localIndex) const;
00234 
00235     /**
00236      * Get the type of the given cell
00237      */
00238     virtual CellType cellType(int cellDim) const;
00239 
00240 
00241     /** Get the label of the given cell */
00242     virtual int label(int cellDim, int cellLID) const;
00243 
00244     /** Get the labels for a batch of cells */
00245     virtual void getLabels(int cellDim, const Array<int>& cellLID,
00246                            Array<int>& labels) const;
00247 
00248 
00249 
00250     /** Get the list of all labels defined for cells of the given dimension */
00251     virtual Set<int> getAllLabelsForDimension(int cellDim) const;
00252 
00253     /**
00254      * Get the cells associated with a specified label. The array
00255      * cellLID will be filled with those cells of dimension cellDim
00256      * having the given label.
00257      */
00258     virtual void getLIDsForLabel(int cellDim, int label, Array<int>& cellLIDs) const;
00259 
00260 
00261     /** Set the label of the given cell */
00262     virtual void setLabel(int cellDim, int cellLID, int label);
00263 
00264     /** Coordinate intermediate cell definitions across processors  */
00265     virtual void assignIntermediateCellGIDs(int cellDim);
00266 
00267     /** */
00268     virtual bool hasIntermediateGIDs(int dim) const;
00269 
00270 
00271   private:
00272 
00273    /** The dimension of the grid*/
00274    int _dimension;
00275 
00276      /** The communicator */
00277    const MPIComm& _comm;
00278 
00279    /** This pointer is the pointer to the 3 dimensional Peano mesh*/
00280    SundancePeanoInterface3D *_peanoMesh;
00281 
00282    /** The unique resolution in each dimension */
00283    double _uniqueResolution;
00284 
00285    /** The Point which is used as a returned argument in 3D*/
00286    static Point returnPoint;
00287 
00288   };
00289   }
00290 #endif
00291 
00292 #endif /* SUNDANCEPEANOMESH3D_H_ */

Site Contact