FEI Version of the Day
snl_fei_LinearSystem_FEData.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 _snl_fei_LinearSystem_FEData_hpp_
00045 #define _snl_fei_LinearSystem_FEData_hpp_
00046 
00047 #include <fei_macros.hpp>
00048 #include <fei_mpi.h>
00049 #include <fei_utils.hpp>
00050 #include <fei_LinearSystem.hpp>
00051 #include <fei_Vector.hpp>
00052 #include <fei_Matrix.hpp>
00053 #include <fei_fwd.hpp>
00054 
00055 namespace fei {
00056   class DirichletBCManager;
00057 }
00058 
00059 namespace snl_fei {
00062   class LinearSystem_FEData : public fei::LinearSystem {
00063   public:
00065     LinearSystem_FEData(fei::SharedPtr<FiniteElementData>& fedata,
00066       fei::SharedPtr<fei::MatrixGraph>& matrixGraph);
00067 
00069     virtual ~LinearSystem_FEData();
00070 
00072     int loadLagrangeConstraint(int constraintID,
00073              const double *weights,
00074              double rhsValue);
00075 
00077     int loadPenaltyConstraint(int constraintID,
00078             const double *weights,
00079             double penaltyValue,
00080             double rhsValue);
00081 
00085     int loadComplete(bool applyBCs=true,
00086                      bool globalAssemble=true);
00087 
00089     fei::SharedPtr<FiniteElementData> getFiniteElementData() { return( feData_ ); }
00090 
00097     int parameters(int numParams,
00098        const char* const* paramStrings)
00099       { return( feData_->parameters(numParams, (char**)paramStrings) ); }
00100 
00102     int parameters(const fei::ParameterSet& params)
00103       {
00104   int numParams = 0;
00105   const char** paramStrings = NULL;
00106   std::vector<std::string> stdstrings;
00107   fei::utils::convert_ParameterSet_to_strings(&params, stdstrings);
00108   fei::utils::strings_to_char_ptrs(stdstrings, numParams, paramStrings);
00109 
00110   int err = parameters(numParams, paramStrings);
00111 
00112   delete [] paramStrings;
00113 
00114   return(err);
00115       }
00116 
00118     int setBCValuesOnVector(fei::Vector* vector);
00119 
00121     void setLookup(Lookup* lookup)
00122       { lookup_ = lookup; }
00123 
00125     bool eqnIsEssentialBC(int globalEqnIndex) const;
00126 
00128     void getEssentialBCs(std::vector<int>& bcEqns,
00129                          std::vector<double>& bcVals) const;
00130 
00132     void getConstrainedEqns(std::vector<int>& crEqns) const;
00133 
00134   private:
00135     int implementBCs(bool applyBCs);
00136 
00137     MPI_Comm comm_;
00138     int localProc_;
00139     int numProcs_;
00140     fei::SharedPtr<fei::Matrix> matrix_;
00141     fei::SharedPtr<fei::Vector> soln_;
00142     fei::SharedPtr<fei::Vector> rhs_;
00143     fei::SharedPtr<FiniteElementData> feData_;
00144     Lookup* lookup_;
00145 
00146     std::vector<char*> attributeNames_;
00147     std::vector<void*> attributes_;
00148   };//class LinearSystem_FEData
00149 }//namespace snl_fei
00150 
00151 #endif // _snl_fei_LinearSystem_FEData_hpp_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends