LinearSystem.cpp

00001 /*------------------------------------------------------------------------*/
00002 /*                 Copyright 2010 Sandia Corporation.                     */
00003 /*  Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive   */
00004 /*  license for use of this work by or on behalf of the U.S. Government.  */
00005 /*  Export of this program may require a license from the                 */
00006 /*  United States Government.                                             */
00007 /*------------------------------------------------------------------------*/
00008 
00009 
00010 #include <stk_linsys/LinearSystem.hpp>
00011 #include <stk_linsys/ImplDetails.hpp>
00012 #include <stk_mesh/base/GetBuckets.hpp>
00013 
00014 #include <stk_linsys/LinsysFunctions.hpp>
00015 
00016 namespace stk {
00017 namespace linsys {
00018 
00019 LinearSystem::LinearSystem(MPI_Comm comm, fei::SharedPtr<fei::Factory> factory)
00020  : m_fei_factory(factory),
00021    m_dof_mapper(comm),
00022    m_fei_mgraph(new fei::MatrixGraph_Impl2(m_dof_mapper.get_fei_VectorSpace(), fei::SharedPtr<fei::VectorSpace>())),
00023    m_fei_linearsystem()
00024 {
00025 }
00026 
00027 LinearSystem::~LinearSystem()
00028 {
00029 }
00030 
00031 void
00032 LinearSystem::synchronize_mappings_and_structure()
00033 {
00034   m_fei_mgraph->initComplete();
00035   m_dof_mapper.finalize();
00036 }
00037 
00038 void
00039 LinearSystem::create_fei_LinearSystem()
00040 {
00041   m_fei_linearsystem = m_fei_factory->createLinearSystem(m_fei_mgraph);
00042 
00043   fei::SharedPtr<fei::Matrix> mtx = m_fei_factory->createMatrix(m_fei_mgraph);
00044   m_fei_linearsystem->setMatrix(mtx);
00045   fei::SharedPtr<fei::Vector> rhs = m_fei_factory->createVector(m_fei_mgraph);
00046   m_fei_linearsystem->setRHS(rhs);
00047   fei::SharedPtr<fei::Vector> soln = m_fei_factory->createVector(m_fei_mgraph,true);
00048   m_fei_linearsystem->setSolutionVector(soln);
00049 }
00050 
00051 void
00052 LinearSystem::finalize_assembly()
00053 {
00054   m_fei_linearsystem->loadComplete();
00055 }
00056 
00057 const DofMapper&
00058 LinearSystem::get_DofMapper() const
00059 {
00060   return m_dof_mapper;
00061 }
00062 
00063 DofMapper&
00064 LinearSystem::get_DofMapper()
00065 {
00066   return m_dof_mapper;
00067 }
00068 
00069 const fei::SharedPtr<fei::MatrixGraph>
00070 LinearSystem::get_fei_MatrixGraph() const
00071 {
00072   return m_fei_mgraph;
00073 }
00074 
00075 fei::SharedPtr<fei::MatrixGraph>
00076 LinearSystem::get_fei_MatrixGraph()
00077 {
00078   return m_fei_mgraph;
00079 }
00080 
00081 const fei::SharedPtr<fei::LinearSystem>
00082 LinearSystem::get_fei_LinearSystem() const
00083 {
00084   return m_fei_linearsystem;
00085 }
00086 
00087 fei::SharedPtr<fei::LinearSystem>
00088 LinearSystem::get_fei_LinearSystem()
00089 {
00090   return m_fei_linearsystem;
00091 }
00092 
00093 int
00094 LinearSystem::solve(int &status, const Teuchos::ParameterList & params )
00095 {
00096   return fei_solve(status, *m_fei_linearsystem, params);
00097 }
00098 
00099 }//namespace linsys
00100 }//namespace stk
00101 

Generated on Tue Jul 13 09:27:32 2010 for Sierra Toolkit by  doxygen 1.4.7