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>
44 if(p_init < 0)
throw Hermes::Exceptions::Exception(
"P_INIT must be >= 0 in an L2 space.");
51 template<
typename Scalar>
53 :
Space<Scalar>(mesh, shapeset, NULL)
55 init(shapeset, p_init);
58 template<
typename Scalar>
59 L2Space<Scalar>::~L2Space()
62 if(this->own_shapeset)
63 delete this->shapeset;
66 template<
typename Scalar>
75 template<
typename Scalar>
80 this->shapeset = shapeset;
81 this->own_shapeset =
false;
84 throw Hermes::Exceptions::Exception(
"Wrong shapeset type in L2Space<Scalar>::set_shapeset()");
87 template<
typename Scalar>
90 if(lsize < this->mesh->get_max_element_id())
92 if(!lsize) lsize = 1000;
93 while (lsize < this->mesh->get_max_element_id()) lsize = lsize * 3 / 2;
94 ldata = (
L2Data*) realloc(ldata,
sizeof(
L2Data) * lsize);
99 template<
typename Scalar>
103 this->bubble_functions_count = 0;
104 for_all_active_elements(e, this->mesh)
107 ed->bdof = this->next_dof;
108 ed->n = this->shapeset->get_num_bubbles(ed->order, e->get_mode());
109 this->next_dof += ed->n * this->stride;
110 this->bubble_functions_count += ed->n;
114 template<
typename Scalar>
115 void L2Space<Scalar>::get_vertex_assembly_list(Element* e,
int iv, AsmList<Scalar>* al)
const
118 template<
typename Scalar>
121 if(e->
id >= this->esize || this->edata[e->
id].order < 0)
122 throw Hermes::Exceptions::Exception(
"Uninitialized element order (id = #%d).", e->
id);
123 if(!this->is_up_to_date())
124 throw Hermes::Exceptions::Exception(
"The space is out of date. You need to update it with assign_dofs()"
125 " any time the mesh changes.");
129 get_bubble_assembly_list(e, al);
131 for(
unsigned int i = 0; i < al->cnt; i++)
133 al->dof[i] += first_dof;
136 template<
typename Scalar>
142 int* indices = this->shapeset->get_bubble_indices(ed->order, e->get_mode());
143 for (
int i = 0, dof = ed->bdof; i < ed->n; i++, dof += this->stride)
146 al->add_triplet(*indices++, dof, 1.0);
150 template<
typename Scalar>
151 void L2Space<Scalar>::get_boundary_assembly_list_internal(Element* e,
int surf_num, AsmList<Scalar>* al)
const
153 this->get_bubble_assembly_list(e, al);
156 template<
typename Scalar>
157 Scalar* L2Space<Scalar>::get_bc_projection(SurfPos* surf_pos,
int order, EssentialBoundaryCondition<Scalar> *bc)
159 throw Hermes::Exceptions::Exception(
"Method get_bc_projection() called from an L2Space.");
163 template HERMES_API
class L2Space<double>;
164 template HERMES_API
class L2Space<std::complex<double> >;