27 void partial_mesh_fem::clear(
void)
28 { mesh_fem::clear(); is_adapted =
false; }
30 partial_mesh_fem::partial_mesh_fem(
const mesh_fem &mef)
32 { is_adapted =
false; }
36 partial_mesh_fem::partial_mesh_fem(
const mesh_fem *mef)
37 : mesh_fem(*(mef ? &(mef->linked_mesh()) : &(void_mesh__))), mf(*mef)
38 { is_adapted =
false; }
40 DAL_SIMPLE_KEY(special_partialmf_key,
pfem);
42 const dal::bit_vector &rejected_elt) {
45 if (!(mi.is_equal(mf.get_qdims()))) {
48 dof_enumeration_made =
false; touch(); v_num = act_counter();
51 fe_convex = mf.convex_index();
52 fe_convex.setminus(rejected_elt);
54 gmm::row_matrix<gmm::rsvector<scalar_type> >
55 RR(kept_dofs.card(), mf.nb_dof());
57 for (dal::bv_visitor i(kept_dofs); !i.finished(); ++i, ++j)
58 RR(j, i) = scalar_type(1);
60 R_ = REDUCTION_MATRIX(kept_dofs.card(), mf.nb_basic_dof());
61 E_ = EXTENSION_MATRIX(mf.nb_basic_dof(), kept_dofs.card());
63 if (mf.is_reduced()) {
64 gmm::row_matrix<gmm::rsvector<scalar_type> >
65 A(kept_dofs.card(), mf.nb_basic_dof());
66 gmm::mult(RR, mf.reduction_matrix(), A);
68 gmm::row_matrix<gmm::rsvector<scalar_type> >
69 B(mf.nb_basic_dof(), kept_dofs.card());
70 gmm::mult(mf.extension_matrix(), gmm::transposed(RR), B);
74 gmm::copy(RR, R_); gmm::copy(gmm::transposed(RR), E_);
78 is_adapted =
true; touch(); v_num = act_counter();
98 { context_check(); mf.context_check();
99 gmm::stream_standard_locale sl(ost);
100 ost <<
'\n' <<
"BEGIN MESH_FEM" <<
'\n' <<
'\n';
101 mf.write_basic_to_file(ost);
102 write_reduction_matrices_to_file(ost);
103 ost <<
"END MESH_FEM" <<
'\n';
107 bool with_mesh)
const {
108 std::ofstream o(name.c_str());
109 GMM_ASSERT1(o,
"impossible to open file '" << name <<
"'");
110 o <<
"% GETFEM MESH_FEM FILE " <<
'\n';
111 o <<
"% GETFEM VERSION " << GETFEM_VERSION <<
'\n' <<
'\n' <<
'\n';
112 if (with_mesh) mf.linked_mesh().write_to_file(o);
119 unsigned N = m.dim();
120 if (P ==
unsigned(-1)) P = N;
123 bgeot::pgeotrans_precomp pgp2 = 0;
125 getfem::pfem_precomp pfp = 0;
126 pintegration_method pim1 = 0;
129 std::vector<scalar_type> area_supports(mf.
nb_basic_dof());
130 dal::bit_vector kept_dofs;
132 for (dal::bv_visitor cv(mim.
convex_index()); !cv.finished(); ++cv) {
133 m.points_of_convex(cv, G);
136 if (pim ==
im_none())
continue;
138 GMM_ASSERT1(pim->type() == IM_APPROX,
139 "Works only with approximate integration");
140 papprox_integration pai2= pim->approx_method();
141 static papprox_integration pai2_old = 0;
142 if (pgt_old != pgt || pai2 != pai2_old) {
144 pgp2 = bgeot::geotrans_precomp(pgt, pai2->pintegration_points(),pim);
146 if (pai2 != pai2_old || pf != pf_old) {
158 for (
size_type i = 0; i < pai2->nb_points_on_convex(); ++i) {
159 for (
unsigned d = 0; d < pf->nb_dof(cv); ++d) {
165 += pai2->coeff(i) * c2.
J() * gmm::sqr(pfp->val(i)[d]);
173 std::vector<scalar_type> areas2(mf.
nb_dof());
174 std::vector<scalar_type> area_supports2(mf.
nb_dof());
182 gmm::copy(areas, areas2);
183 gmm::copy(area_supports, area_supports2);
187 if (area_supports2[i] > pow(1e-14 * areas2[i], scalar_type(P) / N))
void write_to_file(std::ostream &ost) const
Write the mesh_fem to a stream.
virtual pintegration_method int_method_of_element(size_type cv) const
return the integration method associated with an element (in no integration is associated, the function will crash! use the convex_index() of the mesh_im to check that a fem is associated to a given convex)
virtual size_type nb_dof() const
Return the total number of degrees of freedom.
scalar_type APIDECL convex_area_estimate(bgeot::pgeometric_trans pgt, const base_matrix &pts, pintegration_method pim)
rough estimate of the convex area.
a subclass of getfem::mesh_fem which allows to eliminate a number of dof of the original mesh_fem...
virtual pfem fem_of_element(size_type cv) const
Return the basic fem associated with an element (if no fem is associated, the function will crash! us...
Describe a mesh (collection of convexes (elements) and points).
the geotrans_interpolation_context structure is passed as the argument of geometric transformation in...
Describe an integration method linked to a mesh.
scalar_type J() const
get the Jacobian of the geometric trans (taken at point xref() )
const EXTENSION_MATRIX & extension_matrix() const
Return the extension matrix corresponding to reduction applied (RE=I).
size_t size_type
used as the common size type in the library
virtual size_type nb_basic_dof() const
Return the total number of basic degrees of freedom (before the optional reduction).
pintegration_method im_none(void)
return IM_NONE
virtual dim_type get_qdim() const
Return the Q dimension.
void adapt(const dal::bit_vector &kept_dof, const dal::bit_vector &rejected_elt=dal::bit_vector())
build the mesh_fem keeping only the dof of the original mesh_fem which are listed in kept_dof...
bool is_reduced() const
Return true if a reduction matrix is applied to the dofs.
GEneric Tool for Finite Element Methods.
std::shared_ptr< const getfem::virtual_fem > pfem
type of pointer on a fem description
Describe a finite element method linked to a mesh.
pfem_precomp fem_precomp(pfem pf, bgeot::pstored_point_tab pspt, dal::pstatic_stored_object dep)
Handles precomputations for FEM.
const dal::bit_vector & convex_index(void) const
Get the set of convexes where an integration method has been assigned.
pintegration_method classical_approx_im(bgeot::pgeometric_trans pgt, dim_type degree)
try to find an approximate integration method for the geometric transformation pgt which is able to i...
dal::bit_vector select_dofs_from_im(const mesh_fem &mf, const mesh_im &mim, unsigned P=unsigned(-1))
Return a selection of dof who contribute significantly to the mass-matrix that would be computed with...
mesh_fem(const mesh &me, dim_type Q=1)
Build a new mesh_fem.
const mesh & linked_mesh() const
Return a reference to the underlying mesh.
virtual ind_dof_ct ind_basic_dof_of_element(size_type cv) const
Give an array of the dof numbers a of convex.
void set_ii(size_type ii__)
change the current point (assuming a geotrans_precomp_ is used)
std::shared_ptr< const bgeot::geometric_trans > pgeometric_trans
pointer type for a geometric transformation