FEI Version of the Day
snl_fei_Utils.hpp
00001 /*--------------------------------------------------------------------*/
00002 /*    Copyright 2005 Sandia Corporation.                              */
00003 /*    Under the terms of Contract DE-AC04-94AL85000, there is a       */
00004 /*    non-exclusive license for use of this work by or on behalf      */
00005 /*    of the U.S. Government.  Export of this program may require     */
00006 /*    a license from the United States Government.                    */
00007 /*--------------------------------------------------------------------*/
00008 
00009 #ifndef _snl_fei_Utils_hpp_
00010 #define _snl_fei_Utils_hpp_
00011 
00012 #include <fei_fwd.hpp>
00013 #include <fei_mpi.h>
00014 #include <fei_SharedPtr.hpp>
00015 
00016 namespace fei {
00017   class CSVec;
00018   class Matrix;
00019 }
00020 
00021 #include <vector>
00022 #include <map>
00023 #include <string>
00024 
00025 namespace snl_fei {
00026 
00041   const char* getParam(const char* key,
00042            int numParams,
00043            const char* const* paramStrings);
00044 
00061   const char* getParamValue(const char* key,
00062           int numParams,
00063           const char* const* paramStrings,
00064           char separator=' ');
00065 
00079   const char* getParamValue(const char* key,
00080           std::vector<std::string>& params,
00081           char separator=' ');
00082 
00101   const char* getParamValue(const char* key,
00102           int numParams,
00103           const char* const* paramStrings,
00104           int& foundOffset,
00105           char separator=' ');
00106 
00109   int getIntParamValue(const char* key,
00110            int numParams,
00111            const char*const* params,
00112            int& paramValue);
00113 
00117   int getDoubleParamValue(const char* key,
00118         int numParams,
00119         const char*const* params,
00120         double& paramValue);
00121 
00125   int getDoubleParamValue(const char* key,
00126         std::vector<std::string>& params,
00127         double& paramValue);
00128 
00147   const char* getParam(const char* key,
00148            int numParams,
00149            const char* const* paramStrings,
00150            int& foundOffset);
00151 
00169   const char* getParam(const char* key,
00170            std::vector<std::string>& paramStrings,
00171            int& foundOffset);
00172 
00174   int storeNamedAttribute(const char* name,
00175         void* attribute,
00176         std::vector<char*>& attributeNames,
00177         std::vector<void*>& attributes);
00178 
00180   void* retrieveNamedAttribute(const char* name,
00181              std::vector<char*>& attributeNames,
00182              std::vector<void*>& attributes);
00183 
00185   void separate_string(const char* input_string,
00186            const char* substring,
00187            const char*& before_substring,
00188            int& len_before_substring,
00189            const char*& after_substring,
00190            int& len_after_substring);
00191 
00195   unsigned leading_substring_length(const char* string);
00196 
00208   const char* skipSeparator(const char* paramString,
00209           char separator=' ');
00210 
00214   int mergeStringLists(char**& strings, int& numStrings,
00215            const char*const* stringsToMerge, int numStringsToMerge);
00216 
00220   int resolveConflictingCRs(fei::MatrixGraph& matrixGraph,
00221           fei::Matrix& bcEqns,
00222                             const std::vector<int>& bcEqnNumbers);
00223 
00227   int gatherRemoteEssBCs(fei::CSVec& essBCs,
00228        fei::SparseRowGraph* remoteGraph,
00229        fei::Matrix& matrix);
00230 
00231   fei::SharedPtr<fei::SparseRowGraph>
00232     mergeSparseRowGraphs(const fei::SparseRowGraph* srg1,
00233                          const fei::SparseRowGraph* srg2);
00234 
00238   void copy2DBlockDiagToColumnContig(int numBlocks,
00239              const int* blockSizes,
00240              const double*const* values2d,
00241              int format,
00242              double* colcontigvalues);
00243 
00247   void copy2DToColumnContig(int numrows,
00248           int numcols,
00249           const double*const* values2d,
00250           int format,
00251           double* colcontigvalues);
00252 } //namespace snl_fei
00253 
00254 #endif // _snl_fei_Utils_hpp_
00255 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends