37 #ifndef GETFEM_MESH_SLICE_H 38 #define GETFEM_MESH_SLICE_H 43 class slicer_build_stored_mesh_slice;
53 dim_type fcnt, cv_nbfaces;
59 mesh_slicer::cs_nodes_ct
nodes;
63 typedef std::deque<convex_slice> cvlst_ct;
65 struct merged_node_t {
72 mutable std::vector<merged_node_t> merged_nodes;
73 mutable std::vector<size_type> merged_nodes_idx;
74 mutable std::vector<size_type> to_merged_index;
75 mutable bool merged_nodes_available;
79 const mesh *poriginal_mesh;
80 std::vector<size_type> simplex_cnt;
84 std::vector<size_type> cv2pos;
92 : poriginal_mesh(0), points_cnt(0), dim_(
size_type(-1)) {
114 void nb_simplexes(std::vector<size_type>& c)
const { c = simplex_cnt; }
120 const mesh_slicer::cs_nodes_ct&
nodes(
size_type ic)
const {
return cvlst[ic].nodes; }
121 mesh_slicer::cs_nodes_ct&
nodes(
size_type ic) {
return cvlst[ic].nodes; }
133 clear_merged_nodes();
150 {
return merged_nodes_idx.size() - 1; }
156 {
return merged_nodes[merged_nodes_idx[i_merged]].P->pt; }
159 {
return to_merged_index[global_index(ic,ipt)]; }
161 {
return cvlst[ic].global_points_count+ipt; }
169 {
return merged_nodes_idx[i_merged+1] - merged_nodes_idx[i_merged]; }
171 std::vector<merged_node_t>::const_iterator
172 merged_point_nodes(
size_type i_merged)
const {
173 return merged_nodes.begin() + merged_nodes_idx[i_merged];
176 void clear_merged_nodes()
const;
186 void get_edges(std::vector<size_type> &edges,
187 dal::bit_vector &slice_edges,
188 bool from_merged_nodes)
const;
190 void set_convex(
size_type cv, bgeot::pconvex_ref cvr,
191 mesh_slicer::cs_nodes_ct cv_nodes,
192 mesh_slicer::cs_simplexes_ct cv_simplexes,
193 dim_type fcnt,
const dal::bit_vector& splx_in,
225 void write_to_file(
const std::string &fname,
bool with_mesh=
false)
const;
244 template<
typename V1,
typename V2>
void 246 typedef typename gmm::linalg_traits<V2>::value_type T;
247 std::vector<base_node> refpts;
248 std::vector<std::vector<T> > coeff;
255 mf.extend_vector(UU, U);
260 refpts.resize(
nodes(i).size());
261 for (
size_type j=0; j < refpts.size(); ++j)
262 refpts[j] =
nodes(i)[j].pt_ref;
264 pos += refpts.size() * qdim * qqdim;
270 bgeot::vectors_to_base_matrix(G,
273 pfem_precomp pfp = fppool(pf, store_point_tab(refpts));
278 typename std::vector<T>::iterator cit = coeff[qq].begin();
279 for (mesh_fem::ind_dof_ct::const_iterator it=dof.begin();
280 it != dof.end(); ++it, ++cit)
281 *cit = U[(*it)*qqdim+qq];
285 for (
size_type j=0; j < refpts.size(); ++j) {
287 for (
size_type qq = 0; qq < qqdim; ++qq) {
288 typename gmm::sub_vector_type<V2*,
289 gmm::sub_interval>::vector_type dest =
290 gmm::sub_vector(V,gmm::sub_interval(pos,qdim));
291 pf->interpolation(ctx,coeff[qq],dest,dim_type(qdim));
296 GMM_ASSERT1(pos == V.size(),
"bad dimensions");
307 GMM_ASSERT1(sl.cvlst.size() == 0,
308 "the stored_mesh_slice already contains data");
virtual size_type nb_basic_dof_of_element(size_type cv) const
Return the number of degrees of freedom attached to a given convex.
const mesh & linked_mesh() const
return a pointer to the original mesh
virtual size_type nb_dof() const
Return the total number of degrees of freedom.
const mesh_slicer::cs_nodes_ct & nodes(size_type ic) const
Return the list of nodes for the 'ic'th convex of the slice.
base class for static stored objects
size_type nb_points() const
Return the number of nodes in the slice.
size_type nb_merged_nodes() const
Return the number of merged nodes in slice.
size_type convex_pos(size_type cv) const
return the position ic of the referenced convex in the slice convexes list cvlist, corresponding to the original convex number cv
size_type convex_num(size_type ic) const
return the original convex number of the 'ic'th convex referenced in the slice
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).
void build(const getfem::mesh &m, const slicer_action &a, const slicer_action &b, const slicer_action &c, size_type nrefine=1)
Build the slice, by applying three slicer_action operations.
stored_mesh_slice(const getfem::mesh &m, size_type nrefine=1)
Shortcut constructor to simplexify a mesh with refinement.
void clear()
Erase the mesh.
size_type dim() const
return the slice dimension
a getfem::mesh_slicer whose side effect is to build a stored_mesh_slice object.
const base_node merged_point(size_type i_merged) const
Return the physical position of the merged node.
void nb_simplexes(std::vector< size_type > &c) const
return the simplex count, in an array.
size_type merged_point_cnt(size_type i_merged) const
Return the number of nodes that were merged to form the merged one.
void set_dim(size_type newdim)
change the slice dimension (append zeros or truncate node coordinates..)
Apply a serie a slicing operations to a mesh.
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).
void merge(const stored_mesh_slice &sl)
merge with another mesh slice.
void write_to_file(std::ostream &os) const
Save a slice content to a text file.
size_type nb_simplexes(size_type sdim) const
Return the number of simplexes of dimension sdim.
virtual dim_type get_qdim() const
Return the Q dimension.
void interpolate(const getfem::mesh_fem &mf, const V1 &UU, V2 &V) const
Interpolation of a mesh_fem on a slice.
void replay(slicer_action &a) const
Apply the listed slicer_action(s) to the slice object.
size_type nb_convex() const
return the number of convexes of the original mesh referenced in the slice
structure passed as the argument of fem interpolation functions.
void get_edges(std::vector< size_type > &edges, dal::bit_vector &slice_edges, bool from_merged_nodes) const
Extract the list of mesh edges.
void merge_nodes() const
build a list of merged nodes.
The output of a getfem::mesh_slicer which has been recorded.
Define various mesh slicers.
GEneric Tool for Finite Element Methods.
void read_from_file(std::istream &ist, const getfem::mesh &m)
Read a slice from a file.
std::shared_ptr< const getfem::virtual_fem > pfem
type of pointer on a fem description
Describe a finite element method linked to a mesh.
gmm::uint16_type short_type
used as the common short type integer in the library
This slicer does nothing.
void build(const getfem::mesh &m, const slicer_action &a, const slicer_action &b, size_type nrefine=1)
Build the slice, by applying two slicer_action operations.
void build(const getfem::mesh &m, const slicer_action &a, size_type nrefine=1)
Build the slice, by applying a slicer_action operation.
const mesh_slicer::cs_simplexes_ct & simplexes(size_type ic) const
Return the list of simplexes for the 'ic'th convex of the slice.
const mesh & linked_mesh() const
Return a reference to the underlying mesh.
const dal::bit_vector & convex_index() const
Get the set of convexes where a finite element has been assigned.
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)