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