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