libMesh
inter_mesh_projection.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2025 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_INTER_MESH_PROJECTION_H
21 #define LIBMESH_INTER_MESH_PROJECTION_H
22 
23 // Local includes
24 #include "libmesh/libmesh.h"
25 #include "libmesh/mesh.h"
26 #include "libmesh/system.h"
27 #include "libmesh/equation_systems.h"
28 #include "libmesh/mesh_function.h"
29 #include "libmesh/numeric_vector.h"
30 #include "libmesh/numeric_vector.h"
31 #include "libmesh/fem_function_base.h"
32 
33 // C++ includes
34 #include <cstddef>
35 #include <vector>
36 
37 namespace libMesh
38 {
39 
40 // Forward declarations
41 
49 {
50 public:
51 
52  // Constructor, specifies the _from_system whose vectors will be
53  // projected onto the _to_mesh
54  InterMeshProjection(System & _from_system, System & _to_mesh);
55 
56  // Projects from_system vectors onto the to_mesh
58 
59  static Number fptr(const Point & p, const Parameters &, const std::string & libmesh_dbg_var(sys_name), const std::string & unknown_name);
60 
61  static Gradient gptr(const Point & p, const Parameters &, const std::string & libmesh_dbg_var(sys_name), const std::string & unknown_name);
62 
63 private:
64 
65  // Local copy of the _from_system
67 
68  // Local copy of the _to_system
70 
71 };
72 
73 // This class provides the functor we will supply to System::project_vector
74 // inside InterMeshProjection::project_system_vectors.
75 // Object is constructed by passing in a pointer to the mesh function whose
76 // gradient we want to shim via operator().
77 class GradientMeshFunction : public FunctionBase<Gradient>
78 {
79 public:
80  // Constructor
81  GradientMeshFunction(const MeshFunction & _mesh_function);
82 
83  // Destructor
84  virtual ~GradientMeshFunction () { }
85 
86  virtual void init () { }
87 
88  virtual std::unique_ptr<FunctionBase<Gradient>> clone () const
89  {
90  return std::make_unique<GradientMeshFunction>(*mesh_function);
91  }
92 
93  virtual Gradient operator() (const Point & , const Real)
94  { libmesh_not_implemented(); }
95 
96  virtual void operator() (const Point & p, const Real, DenseVector<Gradient> & output);
97 
98 private:
99 
100  // Local copy of the passed in mesh function.
101  std::unique_ptr<MeshFunction> mesh_function;
102 
103 };
104 }
105 
106 #endif // LIBMESH_INTER_MESH_PROJECTION_H
This class provides the ability to map between arbitrary, user-defined strings and several data types...
Definition: parameters.h:67
This class defines a vector in LIBMESH_DIM dimensional Real or Complex space.
The libMesh namespace provides an interface to certain functionality in the library.
virtual Gradient operator()(const Point &, const Real)
This class implements inter mesh projection, i.e.
static Gradient gptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
GradientMeshFunction(const MeshFunction &_mesh_function)
InterMeshProjection(System &_from_system, System &_to_mesh)
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:96
virtual std::unique_ptr< FunctionBase< Gradient > > clone() const
static Number fptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Defines a dense vector for use in Finite Element-type computations.
Definition: dof_map.h:74
This class provides function-like objects for data distributed over a mesh.
Definition: mesh_function.h:54
Base class for functors that can be evaluated at a point and (optionally) time.
virtual void init()
The actual initialization process.
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:39
std::unique_ptr< MeshFunction > mesh_function