FEI Version of the Day
driverData.hpp
00001 /*
00002 // @HEADER
00003 // ************************************************************************
00004 //             FEI: Finite Element Interface to Linear Solvers
00005 //                  Copyright (2005) Sandia Corporation.
00006 //
00007 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the
00008 // 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 Alan Williams (william@sandia.gov) 
00038 //
00039 // ************************************************************************
00040 // @HEADER
00041 */
00042 
00043 
00044 #ifndef _driverData_h_
00045 #define _driverData_h_
00046 
00047 #include <fei_macros.hpp>
00048 #include <fei_defs.h>
00049 
00050 class initElem {
00051  public:
00052   initElem(){}
00053   ~initElem()
00054     {
00055       delete [] nodeIDs;
00056     }
00057   GlobalID elemBlockID;
00058   GlobalID elemID;
00059   int numNodes;
00060   GlobalID* nodeIDs;
00061 };
00062 
00063 class sumInElem {
00064  public:
00065   sumInElem() : stiff1D(NULL), stiffness(NULL), load(NULL) {}
00066   ~sumInElem()
00067     {
00068       delete [] nodeIDs;
00069       delete [] stiff1D;
00070       delete [] stiffness;
00071       delete [] load;
00072     }
00073   GlobalID elemBlockID;
00074   GlobalID elemID;
00075   int numNodes;
00076   GlobalID* nodeIDs;
00077   int numRows;
00078   double* stiff1D;
00079   double** stiffness;
00080   double* load;
00081   int elemFormat;
00082 };
00083 
00084 class nodeBC {
00085  public:
00086   nodeBC():nodeIDs(NULL), alpha(NULL), beta(NULL), gamma(NULL) {}
00087   ~nodeBC()
00088     {
00089       for(int i=0; i<numNodes; ++i) {
00090   delete [] alpha[i];
00091   delete [] beta[i];
00092   delete [] gamma[i];
00093       }
00094       delete [] alpha;
00095       delete [] beta;
00096       delete [] gamma;
00097       delete [] nodeIDs;
00098     }
00099   int numNodes;
00100   GlobalID* nodeIDs;
00101   int fieldID;
00102   int fieldSize;
00103   double** alpha;
00104   double** beta;
00105   double** gamma;
00106 };
00107 
00108 class initCR {
00109  public:
00110   initCR(){}
00111   ~initCR()
00112     {
00113       delete [] nodeIDs;
00114       delete [] fieldIDs;
00115     }
00116 
00117   int numNodes;
00118   GlobalID* nodeIDs;
00119   int* fieldIDs;
00120   int CRID;
00121 };
00122 
00123 class loadCR {
00124  public:
00125   loadCR() {}
00126   ~loadCR()
00127     {
00128       delete [] fieldIDs;
00129       delete [] fieldSizes;
00130       delete [] weights;
00131       delete [] nodeIDs;
00132     }
00133 
00134   int numNodes;
00135   GlobalID* nodeIDs;
00136   int* fieldIDs;
00137   int* fieldSizes;
00138   double* weights;
00139   double CRValue;
00140   double penValue;
00141   int CRID;  
00142 };
00143 
00144 class sharedNodes {
00145  public:
00146   sharedNodes() : nodeIDs(NULL), numProcsPerNode(NULL), sharedProcIDs(NULL){}
00147   ~sharedNodes()
00148     {
00149       for(int i=0; i<numNodes; ++i) delete [] sharedProcIDs[i];
00150       delete [] sharedProcIDs;
00151       delete [] numProcsPerNode;
00152       delete [] nodeIDs;
00153     }
00154 
00155   int numNodes;
00156   GlobalID* nodeIDs;
00157   int* numProcsPerNode;
00158   int** sharedProcIDs;
00159 };
00160 
00161 class parameters {
00162  public:
00163   parameters() : paramList() {}
00164   ~parameters()
00165     {
00166       for(size_t i=0; i<paramList.size(); ++i) delete [] paramList[i];
00167     }
00168 
00169   std::vector<char*> paramList;
00170 };
00171 
00172 class setIDLists {
00173  public:
00174   setIDLists() : matrixIDs(NULL), rhsIDs(NULL) {}
00175   ~setIDLists(){delete [] matrixIDs; delete [] rhsIDs;}
00176 
00177   int* matrixIDs;
00178   int numMatrices;
00179   int* rhsIDs;
00180   int numRHSs;
00181 };
00182 
00183 class putBlockFieldNodeSolution {
00184  public:
00185   putBlockFieldNodeSolution() : nodeIDs(NULL), estimates(NULL) {}
00186   ~putBlockFieldNodeSolution(){delete [] nodeIDs; delete [] estimates;}
00187 
00188   int elemBlockID;
00189   int fieldID;
00190   int fieldSize;
00191   int numNodes;
00192   GlobalID* nodeIDs;
00193   double* estimates;
00194 };
00195 
00196 class driverData {
00197  public:
00198   driverData();
00199   ~driverData();
00200 
00201   int readData(const char* fileName);
00202 
00207   int call_fei_method(const char* method, FEI* fei);
00208 
00209   std::vector<const char*>& get_methodNames() { return( methodNames ); }
00210 
00211  private:
00212   int readData(FEI_ISTREAM* instr, char* keyword);
00213   int getKeyword(FEI_ISTREAM* instr, char*& keyword);
00214 
00215   int is_reg_char(char c);
00216   int skipWhite(FEI_ISTREAM* instr);
00217   int readData(FEI_ISTREAM* instr, int& n);
00218   int readData(FEI_ISTREAM* instr, double& val);
00219   int appendName(const char* name);
00220 
00221   std::vector<const char*> methodNames;
00222   char* temp_;
00223   int tempLen_;
00224 
00225   int solveType_;
00226 
00227   int initFields_numFields_;
00228   int* initFields_fieldSizes_;
00229   int* initFields_fieldIDs_;
00230 
00231   int initElemBlock_numInts_;
00232   int* initElemBlock_ints_;
00233   int* initElemBlock_fieldsPerNode_;
00234   int** initElemBlock_fieldIDs_;
00235   int* initElemBlock_elemDofFieldIDs_;
00236 
00237   std::vector<initElem*> initElems_;
00238   int initElemCounter_;
00239 
00240   std::vector<sumInElem*> sumInElems_;
00241   int sumInElemCounter_;
00242 
00243   std::vector<sumInElem*> sumInElemMatrix_;
00244   int sumInElemMatrixCounter_;
00245 
00246   std::vector<sumInElem*> sumInElemRHS_;
00247   int sumInElemRHSCounter_;
00248 
00249   double resetSystem_;
00250   double resetMatrix_;
00251   double resetRHSVector_;
00252   double resetInitialGuess_;
00253 
00254   std::vector<nodeBC*> loadNodeBCs_;
00255   int loadNodeBCsCounter_;
00256 
00257   std::vector<initCR*> initCRMult_;
00258   int initCRMultCounter_;
00259 
00260   std::vector<loadCR*> loadCRMult_;
00261   int loadCRMultCounter_;
00262 
00263   std::vector<sharedNodes*> initSharedNodes_;
00264   int initSharedNodesCounter_;
00265 
00266   std::vector<parameters*> parameters_;
00267   int parametersCounter_;
00268 
00269   std::vector<setIDLists*> setIDLists_;
00270   int setIDListsCounter_;
00271 
00272   std::vector<int> setCurrentMatrix_;
00273   int setCurrentMatrixCounter_;
00274 
00275   std::vector<int> setCurrentRHS_;
00276   int setCurrentRHSCounter_;
00277 
00278   std::vector<putBlockFieldNodeSolution*> putBlockFieldNodeSolution_;
00279   int putBlockFieldNodeSolutionCounter_;
00280 };
00281 
00282 #endif // _driverData_h_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends