SundancePeanoMesh2D.hpp
Go to the documentation of this file.
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  * SundancePeanoMesh2D.h
00032  *
00033  *  Created on: Sep 8, 2009
00034  *      Author: benk
00035  */
00036 
00037 #ifndef SUNDANCEPEANOMESH2D_H_
00038 #define SUNDANCEPEANOMESH2D_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 "SundancePeanoInterface2D.h"
00049 
00050 namespace Sundance
00051 {
00052 class PeanoMesh2D : public MeshBase{
00053 public:
00054 
00055   /**
00056    * The constuctor for the Peano grid*/
00057   PeanoMesh2D(int dim,
00058     const MPIComm& comm,
00059     const MeshEntityOrder& order);
00060 
00061   /**
00062    * The constuctor for the Peano grid in 2D*/
00063   void createMesh(
00064     double position_x,
00065     double position_y,
00066     double offset_x,
00067     double offset_y,
00068     double resolution);
00069 
00070   /** Dtor */
00071   virtual ~PeanoMesh2D();
00072 
00073   /**
00074    * Get the number of cells having dimension dim
00075    */
00076   virtual int numCells(int dim) const;
00077 
00078   /**
00079    * Return the position of the i-th node
00080    */
00081   virtual Point nodePosition(int i) const;
00082 
00083   /**
00084    * Return a view of the i-th node's position
00085    */
00086   const double* nodePositionView(int i) const;
00087 
00088 
00089 
00090   /**
00091    * Compute the jacobians of a batch of cells, returning the
00092    * result via reference argument
00093    *
00094    * @param cellDim dimension of the cells whose Jacobians are to
00095    * be computed
00096    * @param cellLID local indices of the cells for which Jacobians
00097    * are to be computed
00098    * @param jBatch reference to the resulting Jacobian batch
00099    */
00100   virtual void getJacobians(int cellDim, const Array<int>& cellLID,
00101     CellJacobianBatch& jBatch) const;
00102 
00103   /**
00104    * Compute the diameters of a batch of cells,
00105    * result via reference argument
00106    *
00107    * @param cellDim dimension of the cells whose diameters are to
00108    * be computed
00109    * @param cellLID local indices of the cells for which diameters
00110    * are to be computed
00111    * @param diameters reference to the array of cell diameters
00112    */
00113   virtual void getCellDiameters(int cellDim, const Array<int>& cellLID,
00114     Array<double>& cellDiameters) const;
00115 
00116 
00117   /**
00118    * Map reference quadrature points to physical points on the
00119    * given cells.
00120    */
00121   virtual void pushForward(int cellDim, const Array<int>& cellLID,
00122     const Array<Point>& refQuadPts,
00123     Array<Point>& physQuadPts) const;
00124 
00125   /**
00126    * Return the rank of the processor that owns the given cell
00127    */
00128   virtual int ownerProcID(int cellDim, int cellLID) const;
00129 
00130   /**
00131    * Return the number of facets of the given cell
00132    */
00133   virtual int numFacets(int cellDim, int cellLID,
00134     int facetDim) const;
00135 
00136   /**
00137    * Return the local ID of a facet cell
00138    * @param cellDim dimension of the cell whose facets are being obtained
00139    * @param cellLID local index of the cell whose
00140    * facets are being obtained
00141    * @param facetDim dimension of the desired facet
00142    * @param facetIndex index into the list of the cell's facets
00143    * @param facetOrientation orientation of the facet as seen from
00144    * the given cell (returned via reference)
00145    */
00146   virtual int facetLID(int cellDim, int cellLID,
00147     int facetDim, int facetIndex,
00148     int& facetOrientation) const;
00149 
00150   /**
00151    * Return by reference argument an array containing&(elemVerts_.value(cellLID, 0))
00152    * the LIDs of the facetDim-dimensional facets of the
00153    * given batch of cells
00154    */
00155   virtual void getFacetLIDs(int cellDim,
00156     const Array<int>& cellLID,
00157     int facetDim,
00158     Array<int>& facetLID,
00159     Array<int>& facetSign) const;
00160 
00161   /**
00162    * Return a view of an element's zero-dimensional facets,
00163    * @return an array of integers with the indexes of the points which for it
00164    */
00165   const int* elemZeroFacetView(int cellLID) const;
00166 
00167   /**
00168    * Return the number of maximal cofacets of the given cell
00169    */
00170   virtual int numMaxCofacets(int cellDim, int cellLID) const;
00171 
00172   /**
00173    * Return the local ID of a maximal cofacet cell
00174    * @param cellDim dimension of the cell whose cofacets are being obtained
00175    * @param cellLID local index of the cell whose
00176    * cofacets are being obtained
00177    * @param cofacetIndex which maximal cofacet to get
00178    * @param facetIndex index of the cell cellLID into the list of the
00179    * maximal cell's facets
00180    */
00181   virtual int maxCofacetLID(int cellDim, int cellLID,
00182     int cofacetIndex,
00183     int& facetIndex) const;
00184   /**
00185    * Get the LIDs of the maximal cofacets for a batch of codimension-one
00186    * cells.
00187    *
00188    * \param cellLIDs [in] array of LIDs of the cells whose cofacets are
00189    * being obtained
00190    * \param cofacets [out] the batch of cofacets
00191    */
00192   virtual void getMaxCofacetLIDs(const Array<int>& cellLIDs,
00193     MaximalCofacetBatch& cofacets) const;
00194 
00195 
00196   /**
00197    * Find the cofacets of the given cell
00198    * @param cellDim dimension of the cell whose cofacets are being obtained
00199    * @param cellLID local index of the cell whose
00200    * cofacets are being obtained
00201    * @param cofacetDim dimension of the cofacets to get
00202    * @param cofacetLIDs LIDs of the cofacet
00203    */
00204   void getCofacets(int cellDim, int cellLID,
00205     int cofacetDim, Array<int>& cofacetLIDs) const;
00206 
00207   /**
00208    * Find the local ID of a cell given its global index
00209    */
00210   virtual int mapGIDToLID(int cellDim, int globalIndex) const;
00211 
00212   /**
00213    * Determine whether a given cell GID exists on this processor
00214    */
00215   virtual bool hasGID(int cellDim, int globalIndex) const;
00216 
00217 
00218   /**
00219    * Find the global ID of a cell given its local index
00220    */
00221   virtual int mapLIDToGID(int cellDim, int localIndex) const;
00222 
00223   /**
00224    * Get the type of the given cell
00225    */
00226   virtual CellType cellType(int cellDim) const;
00227 
00228 
00229   /** Get the label of the given cell */
00230   virtual int label(int cellDim, int cellLID) const;
00231 
00232   /** Get the labels for a batch of cells */
00233   virtual void getLabels(int cellDim, const Array<int>& cellLID,
00234     Array<int>& labels) const;
00235 
00236 
00237 
00238   /** Get the list of all labels defined for cells of the given dimension */
00239   virtual Set<int> getAllLabelsForDimension(int cellDim) const;
00240 
00241   /**
00242    * Get the cells associated with a specified label. The array
00243    * cellLID will be filled with those cells of dimension cellDim
00244    * having the given label.
00245    */
00246   virtual void getLIDsForLabel(int cellDim, int label, Array<int>& cellLIDs) const;
00247 
00248 
00249   /** Set the label of the given cell */
00250   virtual void setLabel(int cellDim, int cellLID, int label);
00251 
00252   /** Coordinate intermediate cell definitions across processors  */
00253   virtual void assignIntermediateCellGIDs(int cellDim);
00254 
00255   /** */
00256   virtual bool hasIntermediateGIDs(int dim) const;
00257 
00258 
00259 private:
00260 
00261   /** The dimension of the grid*/
00262   int _dimension;
00263 
00264   /** The communicator */
00265   const MPIComm& _comm;
00266 
00267   /** This pointer is the pointer to the 2 dimensional Peano mesh*/
00268   SundancePeanoInterface2D *_peanoMesh;
00269 
00270   /** The unique resolution in each dimension */
00271   double _uniqueResolution;
00272 
00273   /** The Point which is used as a returned argument */
00274   static Point returnPoint;
00275 
00276 };
00277 }
00278 
00279 #endif /* HAVE_SUNDANCE_PEANO */
00280 #endif /* SUNDANCEPEANOMESH2D_H_ */

Site Contact