121 libmesh_example_requires(3 <= LIBMESH_DIM,
"3D support");
122 #ifndef LIBMESH_HAVE_EIGEN 123 libmesh_example_requires(
false,
"--enable-eigen");
125 #ifndef LIBMESH_HAVE_ZLIB_H 126 libmesh_example_requires(
false,
"--enable-zlib");
129 #ifdef LIBMESH_DEFAULT_TRIPLE_PRECISION 130 libmesh_example_requires(
false,
"--disable-triple-precision");
132 #ifdef LIBMESH_DEFAULT_QUADRUPLE_PRECISION 133 libmesh_example_requires(
false,
"--disable-quadruple-precision");
139 GetPot input(argc, argv);
143 std::vector<Point> tgt_pts;
144 std::vector<Number> tgt_data_idi, tgt_data_rbi;
145 std::vector<std::string> field_vars {
"u",
"v"};
154 rbi.set_field_variables (field_vars);
156 const int n_source_points = input(
"n_source_points", 100);
159 const int my_n_source_points =
160 n_source_points /
init.comm().size() +
161 (
init.comm().rank() < n_source_points %
init.comm().size());
164 idi.get_source_points());
169 const std::vector<Point> & src_pts (idi.get_source_points());
170 std::vector<Number> & src_vals (idi.get_source_vals());
172 src_vals.clear(); src_vals.reserve(2*src_pts.size());
174 for (std::vector<Point>::const_iterator pt_it=src_pts.begin();
175 pt_it != src_pts.end(); ++pt_it)
183 rbi.get_source_points() = idi.get_source_points();
184 rbi.get_source_vals() = idi.get_source_vals();
186 idi.prepare_for_use();
187 rbi.prepare_for_use();
193 const int n_target_points = input(
"n_target_points", 100);
200 idi.interpolate_field_data (field_vars,
204 rbi.interpolate_field_data (field_vars,
208 std::vector<Number>::const_iterator
209 v_idi = tgt_data_idi.begin(),
210 v_rbi = tgt_data_rbi.begin();
212 for (std::vector<Point>::const_iterator p_it=tgt_pts.begin();
213 p_it!=tgt_pts.end(); ++p_it)
216 <<
"\n u_interp_idi=" << *v_idi
217 <<
", u_interp_rbi=" << *v_rbi
222 <<
", v_interp_rbi=" << *v_rbi
236 mesh_a.
read(
"struct.ucd.gz");
237 mesh_b.read(
"unstruct.ucd.gz");
240 const int n_refinements = input(
"n_refinements", 0);
243 #ifndef LIBMESH_ENABLE_AMR 244 libmesh_example_requires(n_refinements==0,
"--enable-amr");
247 mesh_refinement_a.uniformly_refine(n_refinements);
249 mesh_refinement_b.uniformly_refine(n_refinements);
254 es_a(mesh_a), es_b(mesh_b);
257 System & sys_b = es_b.add_system<
System>(
"dest_system");
260 sys_b.add_variable (
"Cp",
FIRST);
274 std::vector<Point> & src_pts (idi.get_source_points());
275 std::vector<Number> & src_vals (idi.get_source_vals());
280 for (
const auto & node : mesh_a.local_node_ptr_range())
282 src_pts.push_back(*node);
286 rbi.set_field_variables({
"Cp"});
287 rbi.get_source_points() = idi.get_source_points();
288 rbi.get_source_vals() = idi.get_source_vals();
291 idi.prepare_for_use();
292 rbi.prepare_for_use();
303 sys_b.project_solution (&mif);
318 sys_b.project_solution (&mif);
This is the EquationSystems class.
Inverse distance interpolation.
Radial Basis Function interpolation.
virtual void write_equation_systems(const std::string &, const EquationSystems &, const std::set< std::string > *system_names=nullptr)
This method implements writing a mesh with data to a specified file where the data is taken from the ...
Real exact_solution_v(const Point &p)
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
Number current_solution(const dof_id_type global_dof_number) const
void init_sys(EquationSystems &es, const std::string &system_name)
Implements (adaptive) mesh refinement algorithms for a MeshBase.
Manages consistently variables, degrees of freedom, and coefficient vectors.
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
unsigned int add_variable(std::string_view var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
Adds the variable var to the list of variables for this system.
Real exact_solution_u(const Point &p)
void set_field_variables(std::vector< std::string > names)
Defines the field variable(s) we are responsible for, and importantly their assumed ordering...
This class implements writing meshes in the Tecplot format.
virtual void read(const std::string &name, void *mesh_data=nullptr, bool skip_renumber_nodes_and_elements=false, bool skip_find_neighbors=false) override
Reads the file specified by name.
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
void attach_init_function(void fptr(EquationSystems &es, const std::string &name))
Register a user function to use in initializing the system.
void create_random_point_cloud(const unsigned int Npts, std::vector< Point > &pts, const Real max_range=10)