LinSystem Class Reference

#include <linsystem.h>

Inherited by NonlinSystem.

List of all members.

Classes

struct  Compare
struct  Key

Public Member Functions

 LinSystem ()
 LinSystem (WeakForm *wf, Solver *solver)
 LinSystem (WeakForm *wf)
 LinSystem (WeakForm *wf, Solver *solver, Space *s)
 LinSystem (WeakForm *wf, Space *s)
 LinSystem (WeakForm *wf, Solver *solver, int n,...)
 LinSystem (WeakForm *wf, int n,...)
virtual ~LinSystem ()
void init (WeakForm *wf, Solver *solver)
void init_spaces (int n,...)
void init_space (Space *s)
void set_spaces (int n,...)
void set_space (Space *s)
void set_pss (int n,...)
void set_pss (PrecalcShapeset *p)
void copy (LinSystem *sys)
Spaceget_space (int n)
Meshget_mesh (int n)
PrecalcShapesetget_pss (int n)
virtual bool is_linear ()
 Helps to determine if linear or nonlinear class instance is used similar to Java instanceof functionality.
virtual void assemble (bool rhsonly=false)
void assemble_rhs_only ()
bool solve (int n,...)
bool solve (Solution *sln)
virtual void free ()
virtual void matrix_free ()
void save_matrix_matlab (const char *filename, const char *varname="A")
void save_rhs_matlab (const char *filename, const char *varname="b")
void save_matrix_bin (const char *filename)
void save_rhs_bin (const char *filename)
void enable_dir_contrib (bool enable=true)
scalarget_solution_vector ()
int get_num_dofs ()
int get_num_dofs (int i)
int get_num_spaces () const
int get_num_meshes () const
int get_matrix_size () const
void get_matrix (int *&Ap, int *&Ai, scalar *&Ax, int &size) const
void get_rhs (scalar *&RHS, int &size) const
void get_solution_vector (scalar *&sln_vector, int &sln_vector_len)
void get_solution_vector (std::vector< scalar > &sln_vector_out) const
 Returns a copy of a solution vector.
void set_vec_zero ()
 Creates a zero solution coefficient vector Vec (after freeing it first if it is not NULL).
void project_global_n (int proj_norm, int n,...)
 Basic procedure performing orthogonal projection for an arbitrary number of functions onto (the same number of) spaces determined by the LinSystem; proj_norm = 0 for L2 norm, proj_norm = 1 for H1 norm, proj_norm = 2 for Hcurl norm. Projected can be any MeshFunction, Solution or Filter. The result of the projection will satisfy essential boundary conditions. The projection defines the vector Vec in the class LinSystem. All projection functionality defined here is also available in the class NonlinSystem. TODO: Implement projection-based interpolation (PBI) as an alternative of this. PBI is almost as good as global orthogonal projection but way faster.
void project_global (MeshFunction *fn, Solution *result, int proj_norm=1)
 Global orthogonal projection of MeshFunction* fn. Result of the projection is returned as "result".
void project_global (MeshFunction *fn1, MeshFunction *fn2, Solution *result1, Solution *result2, int proj_norm=1)
 Global orthogonal projection of two functions.
void project_global (MeshFunction *fn1, MeshFunction *fn2, MeshFunction *fn3, Solution *result1, Solution *result2, Solution *result3, int proj_norm=1)
 Global orthogonal projection of three functions.
void project_global (MeshFunction *fn1, MeshFunction *fn2, MeshFunction *fn3, MeshFunction *fn4, Solution *result1, Solution *result2, Solution *result3, Solution *result4, int proj_norm=1)
 Global orthogonal projection of four functions.
void project_global (scalar(*exactfn)(double x, double y, scalar &dx, scalar &dy), Solution *result, int proj_norm=1)
 Global orthogonal projection of an exact function.
void project_global (scalar(*exactfn1)(double x, double y, scalar &dx, scalar &dy), scalar(*exactfn2)(double x, double y, scalar &dx, scalar &dy), Solution *result1, Solution *result2, int proj_norm=1)
 Global orthogonal projection of two exact functions.
void project_global (scalar(*exactfn1)(double x, double y, scalar &dx, scalar &dy), scalar(*exactfn2)(double x, double y, scalar &dx, scalar &dy), scalar(*exactfn3)(double x, double y, scalar &dx, scalar &dy), Solution *result1, Solution *result2, Solution *result3, int proj_norm=1)
 Global orthogonal projection of three exact functions.
void project_local (scalar(*exactfn)(double x, double y, scalar &dx, scalar &dy), Mesh *mesh, Solution *result, int proj_norm=1)
 Projection-based interpolation of an exact function. This is faster than the global projection since no global matrix problem is solved.
void free_meshes_and_spaces ()
 Frees reference spaces and meshes. Called automatically on desctruction.

Protected Member Functions

void create_matrix (bool rhsonly)
void insert_block (scalar **mat, int *iidx, int *jidx, int ilen, int jlen)
ExtData< Ord > * init_ext_fns_ord (std::vector< MeshFunction * > &ext)
ExtData< scalar > * init_ext_fns (std::vector< MeshFunction * > &ext, RefMap *rm, const int order)
Func< double > * get_fn (PrecalcShapeset *fu, RefMap *rm, const int order)
void init_cache ()
void delete_cache ()
scalar eval_form (WeakForm::BiFormVol *bf, PrecalcShapeset *fu, PrecalcShapeset *fv, RefMap *ru, RefMap *rv)
scalar eval_form (WeakForm::LiFormVol *lf, PrecalcShapeset *fv, RefMap *rv)
scalar eval_form (WeakForm::BiFormSurf *bf, PrecalcShapeset *fu, PrecalcShapeset *fv, RefMap *ru, RefMap *rv, EdgePos *ep)
scalar eval_form (WeakForm::LiFormSurf *lf, PrecalcShapeset *fv, RefMap *rv, EdgePos *ep)
scalar ** get_matrix_buffer (int n)

Protected Attributes

WeakFormwf
Solversolver
void * slv_ctx
Space ** spaces
Mesh ** meshes
PrecalcShapeset ** pss
int ndofs
int num_spaces
CooMatrix * A
bool mat_sym
 true if symmetric and only upper half stored
scalarRHS
 assembled right-hand side
scalarDir
 contributions to the RHS from Dirichlet DOFs
scalarVec
 last solution vector
std::map< Key, Func< double >
*, Compare
cache_fn
Geom< double > * cache_e [g_max_quad+1+4]
double * cache_jwt [g_max_quad+1+4]
scalar ** buffer
int mat_size
int * sp_seq
int wf_seq
int num_user_pss
bool values_changed
bool struct_changed
bool want_dir_contrib
bool have_spaces

Friends

class RefSystem

Constructor & Destructor Documentation

LinSystem::LinSystem (  ) 
LinSystem::LinSystem ( WeakForm wf,
Solver solver 
)
LinSystem::LinSystem ( WeakForm wf  ) 
LinSystem::LinSystem ( WeakForm wf,
Solver solver,
Space s 
)
LinSystem::LinSystem ( WeakForm wf,
Space s 
)
LinSystem::LinSystem ( WeakForm wf,
Solver solver,
int  n,
  ... 
)
LinSystem::LinSystem ( WeakForm wf,
int  n,
  ... 
)
LinSystem::~LinSystem (  )  [virtual]

Member Function Documentation

void LinSystem::assemble ( bool  rhsonly = false  )  [virtual]

Todo:
Do not retrieve assembly list gain if the element has not changed

Reimplemented in NonlinSystem, and RefSystem.

void LinSystem::assemble_rhs_only (  )  [inline]
void LinSystem::copy ( LinSystem sys  ) 
void LinSystem::create_matrix ( bool  rhsonly  )  [protected]
void LinSystem::delete_cache (  )  [protected]
void LinSystem::enable_dir_contrib ( bool  enable = true  )  [inline]
scalar LinSystem::eval_form ( WeakForm::LiFormSurf lf,
PrecalcShapeset fv,
RefMap rv,
EdgePos ep 
) [protected]
scalar LinSystem::eval_form ( WeakForm::BiFormSurf bf,
PrecalcShapeset fu,
PrecalcShapeset fv,
RefMap ru,
RefMap rv,
EdgePos ep 
) [protected]
scalar LinSystem::eval_form ( WeakForm::LiFormVol lf,
PrecalcShapeset fv,
RefMap rv 
) [protected]
scalar LinSystem::eval_form ( WeakForm::BiFormVol bf,
PrecalcShapeset fu,
PrecalcShapeset fv,
RefMap ru,
RefMap rv 
) [protected]
void LinSystem::free (  )  [virtual]

Reimplemented in NonlinSystem.

void LinSystem::free_meshes_and_spaces (  ) 

Frees reference spaces and meshes. Called automatically on desctruction.

Func< double > * LinSystem::get_fn ( PrecalcShapeset fu,
RefMap rm,
const int  order 
) [protected]
void LinSystem::get_matrix ( int *&  Ap,
int *&  Ai,
scalar *&  Ax,
int &  size 
) const

XXX: this is a memory leak:

scalar** LinSystem::get_matrix_buffer ( int  n  )  [inline, protected]
int LinSystem::get_matrix_size (  )  const
Mesh* LinSystem::get_mesh ( int  n  )  [inline]
int LinSystem::get_num_dofs ( int  i  )  [inline]
int LinSystem::get_num_dofs (  ) 
int LinSystem::get_num_meshes (  )  const [inline]
int LinSystem::get_num_spaces (  )  const [inline]
PrecalcShapeset* LinSystem::get_pss ( int  n  )  [inline]
void LinSystem::get_rhs ( scalar *&  RHS,
int &  size 
) const [inline]
void LinSystem::get_solution_vector ( std::vector< scalar > &  sln_vector_out  )  const

Returns a copy of a solution vector.

void LinSystem::get_solution_vector ( scalar *&  sln_vector,
int &  sln_vector_len 
) [inline]
scalar* LinSystem::get_solution_vector (  )  [inline]
Space* LinSystem::get_space ( int  n  )  [inline]
void LinSystem::init ( WeakForm wf,
Solver solver 
)
void LinSystem::init_cache (  )  [protected]
ExtData< scalar > * LinSystem::init_ext_fns ( std::vector< MeshFunction * > &  ext,
RefMap rm,
const int  order 
) [protected]
ExtData< Ord > * LinSystem::init_ext_fns_ord ( std::vector< MeshFunction * > &  ext  )  [protected]
void LinSystem::init_space ( Space s  ) 
void LinSystem::init_spaces ( int  n,
  ... 
)
void LinSystem::insert_block ( scalar **  mat,
int *  iidx,
int *  jidx,
int  ilen,
int  jlen 
) [protected]
virtual bool LinSystem::is_linear (  )  [inline, virtual]

Helps to determine if linear or nonlinear class instance is used similar to Java instanceof functionality.

Reimplemented in NonlinSystem.

void LinSystem::matrix_free (  )  [virtual]
void LinSystem::project_global ( scalar(*)(double x, double y, scalar &dx, scalar &dy)  exactfn1,
scalar(*)(double x, double y, scalar &dx, scalar &dy)  exactfn2,
scalar(*)(double x, double y, scalar &dx, scalar &dy)  exactfn3,
Solution result1,
Solution result2,
Solution result3,
int  proj_norm = 1 
) [inline]

Global orthogonal projection of three exact functions.

void LinSystem::project_global ( scalar(*)(double x, double y, scalar &dx, scalar &dy)  exactfn1,
scalar(*)(double x, double y, scalar &dx, scalar &dy)  exactfn2,
Solution result1,
Solution result2,
int  proj_norm = 1 
) [inline]

Global orthogonal projection of two exact functions.

void LinSystem::project_global ( scalar(*)(double x, double y, scalar &dx, scalar &dy)  exactfn,
Solution result,
int  proj_norm = 1 
) [inline]

Global orthogonal projection of an exact function.

void LinSystem::project_global ( MeshFunction fn1,
MeshFunction fn2,
MeshFunction fn3,
MeshFunction fn4,
Solution result1,
Solution result2,
Solution result3,
Solution result4,
int  proj_norm = 1 
) [inline]

Global orthogonal projection of four functions.

void LinSystem::project_global ( MeshFunction fn1,
MeshFunction fn2,
MeshFunction fn3,
Solution result1,
Solution result2,
Solution result3,
int  proj_norm = 1 
) [inline]

Global orthogonal projection of three functions.

void LinSystem::project_global ( MeshFunction fn1,
MeshFunction fn2,
Solution result1,
Solution result2,
int  proj_norm = 1 
) [inline]

Global orthogonal projection of two functions.

void LinSystem::project_global ( MeshFunction fn,
Solution result,
int  proj_norm = 1 
) [inline]

Global orthogonal projection of MeshFunction* fn. Result of the projection is returned as "result".

void LinSystem::project_global_n ( int  proj_norm,
int  n,
  ... 
)

Basic procedure performing orthogonal projection for an arbitrary number of functions onto (the same number of) spaces determined by the LinSystem; proj_norm = 0 for L2 norm, proj_norm = 1 for H1 norm, proj_norm = 2 for Hcurl norm. Projected can be any MeshFunction, Solution or Filter. The result of the projection will satisfy essential boundary conditions. The projection defines the vector Vec in the class LinSystem. All projection functionality defined here is also available in the class NonlinSystem. TODO: Implement projection-based interpolation (PBI) as an alternative of this. PBI is almost as good as global orthogonal projection but way faster.

void LinSystem::project_local ( scalar(*)(double x, double y, scalar &dx, scalar &dy)  exactfn,
Mesh mesh,
Solution result,
int  proj_norm = 1 
) [inline]

Projection-based interpolation of an exact function. This is faster than the global projection since no global matrix problem is solved.

TODO

void LinSystem::save_matrix_bin ( const char *  filename  ) 
void LinSystem::save_matrix_matlab ( const char *  filename,
const char *  varname = "A" 
)
void LinSystem::save_rhs_bin ( const char *  filename  ) 
void LinSystem::save_rhs_matlab ( const char *  filename,
const char *  varname = "b" 
)
void LinSystem::set_pss ( PrecalcShapeset p  ) 
void LinSystem::set_pss ( int  n,
  ... 
)

Reimplemented in RefSystem, and RefNonlinSystem.

void LinSystem::set_space ( Space s  ) 
void LinSystem::set_spaces ( int  n,
  ... 
)

Reimplemented in RefSystem, and RefNonlinSystem.

void LinSystem::set_vec_zero (  ) 

Creates a zero solution coefficient vector Vec (after freeing it first if it is not NULL).

bool LinSystem::solve ( Solution sln  ) 

Reimplemented in NonlinSystem.

bool LinSystem::solve ( int  n,
  ... 
)

Reimplemented in NonlinSystem.


Friends And Related Function Documentation

friend class RefSystem [friend]

Member Data Documentation

CooMatrix* LinSystem::A [protected]
scalar** LinSystem::buffer [protected]
Geom<double>* LinSystem::cache_e[g_max_quad+1+4] [protected]
std::map<Key, Func<double>*, Compare> LinSystem::cache_fn [protected]
double* LinSystem::cache_jwt[g_max_quad+1+4] [protected]
scalar* LinSystem::Dir [protected]

contributions to the RHS from Dirichlet DOFs

bool LinSystem::have_spaces [protected]
int LinSystem::mat_size [protected]
bool LinSystem::mat_sym [protected]

true if symmetric and only upper half stored

Mesh** LinSystem::meshes [protected]
int LinSystem::ndofs [protected]
int LinSystem::num_spaces [protected]
int LinSystem::num_user_pss [protected]
scalar* LinSystem::RHS [protected]

assembled right-hand side

void* LinSystem::slv_ctx [protected]
Solver* LinSystem::solver [protected]
int* LinSystem::sp_seq [protected]
Space** LinSystem::spaces [protected]
bool LinSystem::struct_changed [protected]
bool LinSystem::values_changed [protected]
scalar* LinSystem::Vec [protected]

last solution vector

bool LinSystem::want_dir_contrib [protected]
WeakForm* LinSystem::wf [protected]
int LinSystem::wf_seq [protected]

The documentation for this class was generated from the following files:
Generated on Sat Jun 5 15:17:43 2010 for Hermes2D Library: Real Version by  doxygen 1.6.3