GetFEM++  5.3
getfem_mesh_fem_global_function.cc
1 /*===========================================================================
2 
3  Copyright (C) 2004-2017 Yves Renard
4  Copyright (C) 2016-2017 Konstantinos Poulios
5 
6  This file is a part of GetFEM++
7 
8  GetFEM++ is free software; you can redistribute it and/or modify it
9  under the terms of the GNU Lesser General Public License as published
10  by the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version along with the GCC Runtime Library
12  Exception either version 3.1 or (at your option) any later version.
13  This program is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16  License and GCC Runtime Library Exception for more details.
17  You should have received a copy of the GNU Lesser General Public License
18  along with this program; if not, write to the Free Software Foundation,
19  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20 
21 ===========================================================================*/
22 
24 
25 namespace getfem {
26 
27 
28  void mesh_fem_global_function::set_functions
29  (const std::vector<pglobal_function>& funcs, const mesh_im &mim) {
30  GMM_ASSERT1(linked_mesh_ != 0, "Mesh fem need to be initialized with"
31  " a mesh first.");
32  clear();
33  if (&mim == &dummy_mesh_im())
35  else {
36  GMM_ASSERT1(&(mim.linked_mesh()) == linked_mesh_,
37  "The provided mesh_im has to be linked to the same mesh"
38  " as this mesh_fem.");
39  fem_ = getfem::new_fem_global_function(funcs, mim);
40  }
41  set_finite_element(fem_);
42  }
43 
44  // mesh_fem_global_function::size_type memsize() const;
45 
46  void mesh_fem_global_function::clear() {
47  mesh_fem::clear();
48  if (fem_.get()) {
50  fem_.reset();
51  }
52  }
53 
54 }
55 
56 /* end of namespace getfem */
const mesh_im & dummy_mesh_im()
Dummy mesh_im for default parameter of functions.
void del_fem_global_function(const pfem &pf)
release a global function FEM
Define a mesh_fem with base functions which are global functions given by the user.
void set_finite_element(size_type cv, pfem pf)
Set the finite element method of a convex.
GEneric Tool for Finite Element Methods.
const mesh & linked_mesh() const
Return a reference to the underlying mesh.
pfem new_fem_global_function(const std::vector< pglobal_function > &funcs, const mesh &m)
create a new global function FEM.