20 #include "shapeset/shapeset_l2_all.h"
21 #include "boundary_conditions/essential_boundary_conditions.h"
27 template<
typename Scalar>
28 L2Space<Scalar>::L2Space() : Space<Scalar>()
32 template<
typename Scalar>
35 if (shapeset ==
nullptr)
38 this->own_shapeset =
true;
46 throw Hermes::Exceptions::Exception(
"P_INIT must be >= 0 in an L2 space.");
48 this->set_uniform_order_internal(p_init, HERMES_ANY_INT);
54 template<
typename Scalar>
56 :
Space<Scalar>(mesh, shapeset, nullptr)
58 init(shapeset, p_init);
61 template<
typename Scalar>
62 L2Space<Scalar>::~L2Space()
66 template<
typename Scalar>
69 this->set_shapeset(space->get_shapeset(),
true);
74 template<
typename Scalar>
77 if (!(shapeset->
get_id() < 40 && shapeset->
get_id() > 29))
78 throw Hermes::Exceptions::Exception(
"Wrong shapeset type in L2Space<Scalar>::set_shapeset()");
82 if (this->own_shapeset)
83 delete this->shapeset;
85 this->shapeset = shapeset->clone();
89 this->shapeset = shapeset;
90 this->own_shapeset =
false;
94 template<
typename Scalar>
98 this->bubble_functions_count = 0;
99 for_all_active_elements(e, this->mesh)
102 ed->bdof = this->next_dof;
104 ed->n = this->shapeset->get_num_bubbles(ed->order, e->get_mode());
105 this->next_dof += ed->n;
106 this->bubble_functions_count += ed->n;
110 template<
typename Scalar>
111 void L2Space<Scalar>::get_vertex_assembly_list(Element* e,
int iv, AsmList<Scalar>* al)
const
114 template<
typename Scalar>
119 get_bubble_assembly_list(e, al);
122 template<
typename Scalar>
128 short* indices = this->shapeset->get_bubble_indices(ed->order, e->get_mode());
129 for (
unsigned short i = 0, dof = ed->bdof; i < ed->n; i++, dof++)
136 template<
typename Scalar>
137 void L2Space<Scalar>::get_boundary_assembly_list_internal(Element* e,
int surf_num, AsmList<Scalar>* al)
const
139 this->get_bubble_assembly_list(e, al);
142 template<
typename Scalar>
143 Scalar* L2Space<Scalar>::get_bc_projection(SurfPos* surf_pos,
int order, EssentialBoundaryCondition<Scalar> *bc)
145 throw Hermes::Exceptions::Exception(
"Method get_bc_projection() called from an L2Space.");
149 template<
typename Scalar>
150 L2MarkerWiseConstSpace<Scalar>::L2MarkerWiseConstSpace(MeshSharedPtr mesh) : L2Space<Scalar>(mesh, 0)
154 template<
typename Scalar>
155 void L2MarkerWiseConstSpace<Scalar>::assign_bubble_dofs()
158 this->bubble_functions_count = 0;
160 for_all_active_elements(e, this->mesh)
162 typename Space<Scalar>::ElementData* ed = &this->edata[e->id];
163 ed->bdof = this->next_dof + e->marker - 1;
165 max_marker = std::max(max_marker, e->marker);
167 this->next_dof += max_marker;
168 this->bubble_functions_count = max_marker;
171 template HERMES_API
class L2Space < double > ;
172 template HERMES_API
class L2Space < std::complex<double> > ;
174 template HERMES_API
class L2MarkerWiseConstSpace < double > ;
175 template HERMES_API
class L2MarkerWiseConstSpace < std::complex<double> > ;
virtual void set_shapeset(Shapeset *shapeset, bool clone=false)
Sets the shapeset.
Stores one element of a mesh.
void init()
Common code for constructors.
void add_triplet(int i, int d, Scalar c)
Adds a record for one basis function (shape functions index, basis functions index, coefficient).
Used to pass the instances of Space around.
Common definitions for Hermes2D.
virtual void copy(SpaceSharedPtr< Scalar > space, MeshSharedPtr new_mesh)
Copy from Space instance 'space'.
virtual void copy(SpaceSharedPtr< Scalar > space, MeshSharedPtr new_mesh)
virtual void get_element_assembly_list(Element *e, AsmList< Scalar > *al) const
Obtains an assembly list for the given element.
unsigned short cnt
the number of items in the arrays idx, dof and coef
virtual unsigned char get_id() const =0
Should be exactly the same as is the count of enum ShapesetType.
Represents a finite element space over a domain.
L2ShapesetLegendre L2Shapeset
This is the default shapeset typedef.