26gsMassAssembler<T>::gsMassAssembler(
const gsMultiPatch<T> & patches,
27 const gsMultiBasis<T> & basis,
28 const gsBoundaryConditions<T> & bconditions,
29 const gsFunction<T> & body_force)
35 gsPiecewiseFunction<T> rightHandSides;
36 rightHandSides.addPiece(body_force);
37 typename gsPde<T>::Ptr pde(
new gsBasePde<T>(patches,bconditions,rightHandSides) );
42 m_dim = body_force.targetDim();
43 for (
short_t d = 0; d < m_dim; ++d)
44 m_bases.push_back(basis);
46 Base::initialize(pde, m_bases, defaultOptions());
53 opt.
addReal(
"Density",
"Density of the material",1.);
60 GISMO_ENSURE(m_dim == m_pde_ptr->domain().parDim(),
"The RHS dimension and the domain dimension don't match!");
61 GISMO_ENSURE(m_dim == 2 || m_dim == 3,
"Only two- and three-dimenstion domains are supported!");
63 std::vector<gsDofMapper> m_dofMappers(m_bases.size());
64 for (
unsigned d = 0; d < m_bases.size(); d++)
65 m_bases[d].getMapper((dirichlet::strategy)m_options.getInt(
"DirichletStrategy"),
66 iFace::glue,m_pde_ptr->bc(),m_dofMappers[d],d,
true);
70 m_options.setReal(
"bdO",m_bases.size()*(1+m_options.getReal(
"bdO"))-1);
71 m_system.reserve(m_bases[0], m_options, 1);
73 for (
unsigned d = 0; d < m_bases.size(); ++d)
74 Base::computeDirichletDofs(d);
81 m_system.matrix().setZero();
82 m_system.reserve(m_bases[0], m_options, 1);
83 m_system.rhs().setZero(Base::numDofs(),1);
85 if (saveEliminationMatrix)
87 eliminationMatrix.resize(Base::numDofs(),Base::numFixedDofs());
88 eliminationMatrix.setZero();
89 eliminationMatrix.reservePerColumn(m_system.numColNz(m_bases[0],m_options));
92 gsVisitorMassElasticity<T> visitor(saveEliminationMatrix ? &eliminationMatrix :
nullptr);
93 Base::template push<gsVisitorMassElasticity<T> >(visitor);
95 m_system.matrix().makeCompressed();
97 if (saveEliminationMatrix)
99 Base::rhsWithZeroDDofs = m_system.rhs();
100 eliminationMatrix.makeCompressed();
virtual void assemble()
Main assemble routine, to be implemented in derived classes.
Definition gsMassAssembler.h:50
virtual void refresh()
Refresh routine to set dof-mappers.
Definition gsMassAssembler.hpp:58
static gsOptionList defaultOptions()
Returns the list of default options for assembly.
Definition gsMassAssembler.hpp:50
Class which holds a list of parameters/options, and provides easy access to them.
Definition gsOptionList.h:33
void addReal(const std::string &label, const std::string &desc, const Real &value)
Adds a option named label, with description desc and value value.
Definition gsOptionList.cpp:211
A sparse linear system indexed by sets of degrees of freedom.
Definition gsSparseSystem.h:30
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
IMHO, a useless class, but it is necessary to use the gsAssembler class. Contains proper information ...
#define short_t
Definition gsConfig.h:35
#define GISMO_ENSURE(cond, message)
Definition gsDebug.h:102
Provides mass matrix for elasticity systems in 2D plain strain and 3D continua.
Visitor class for the mass matrix assembly for elasticity problems.
The G+Smo namespace, containing all definitions for the library.