Go to the documentation of this file.
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();
136 void merge(
const stored_mesh_slice& sl);
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,
218 void replay(slicer_action &a, slicer_action &b, slicer_action &c)
const
220 void replay(slicer_action *a, slicer_action *b, slicer_action *c)
const;
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");
void clear()
Erase the mesh.
virtual dim_type get_qdim() const
Return the Q dimension.
a getfem::mesh_slicer whose side effect is to build a stored_mesh_slice object.
The output of a getfem::mesh_slicer which has been recorded.
size_type nb_merged_nodes() const
Return the number of merged nodes in slice.
size_t size_type
used as the common size type in the library
size_type convex_pos(size_type cv) const
return the position ic of the referenced convex in the slice convexes list cvlist,...
Apply a serie a slicing operations to a mesh.
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!...
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.
void write_to_file(std::ostream &os) const
Save a slice content to a text file.
Describe a finite element method linked to a mesh.
void get_edges(std::vector< size_type > &edges, dal::bit_vector &slice_edges, bool from_merged_nodes) const
Extract the list of mesh edges.
stored_mesh_slice(const getfem::mesh &m, size_type nrefine=1)
Shortcut constructor to simplexify a mesh with refinement.
size_type nb_points() const
Return the number of nodes in the slice.
void set_dim(size_type newdim)
change the slice dimension (append zeros or truncate node coordinates..)
gmm::uint16_type short_type
used as the common short type integer in the library
GEneric Tool for Finite Element Methods.
structure passed as the argument of fem interpolation functions.
void merge(const stored_mesh_slice &sl)
merge with another mesh slice.
const dal::bit_vector & convex_index() const
Get the set of convexes where a finite element has been assigned.
virtual size_type nb_basic_dof_of_element(size_type cv) const
Return the number of degrees of freedom attached to a given convex.
virtual size_type nb_basic_dof() const
Return the total number of basic degrees of freedom (before the optional reduction).
size_type nb_convex() const
return the number of convexes of the original mesh referenced in the slice
void interpolate(const getfem::mesh_fem &mf, const V1 &UU, V2 &V) const
Interpolation of a mesh_fem on a slice.
void merge_nodes() const
build a list of merged nodes.
void set_ii(size_type ii__)
change the current point (assuming a geotrans_precomp_ is used)
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
const mesh & linked_mesh() const
Return a reference to the underlying mesh.
This slicer does nothing.
size_type dim() const
return the slice dimension
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.
const mesh_slicer::cs_nodes_ct & nodes(size_type ic) const
Return the list of nodes for the 'ic'th convex of the slice.
void build(const getfem::mesh &m, const slicer_action &a, size_type nrefine=1)
Build the slice, by applying a slicer_action operation.
Define various mesh slicers.
base class for static stored objects
Describe a mesh (collection of convexes (elements) and points).
const base_node merged_point(size_type i_merged) const
Return the physical position of the merged node.
virtual ind_dof_ct ind_basic_dof_of_element(size_type cv) const
Give an array of the dof numbers a of convex.
size_type convex_num(size_type ic) const
return the original convex number of the 'ic'th convex referenced in the slice
const mesh_slicer::cs_simplexes_ct & simplexes(size_type ic) const
Return the list of simplexes for the 'ic'th convex of the slice.
void replay(slicer_action &a) const
Apply the listed slicer_action(s) to the slice object.
size_type nb_simplexes(size_type sdim) const
Return the number of simplexes of dimension sdim.
size_type merged_point_cnt(size_type i_merged) const
Return the number of nodes that were merged to form the merged one.
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.
void nb_simplexes(std::vector< size_type > &c) const
return the simplex count, in an array.