28 #include "libmesh/libmesh.h"
29 #include "libmesh/meshfree_interpolation.h"
30 #include "libmesh/radial_basis_interpolation.h"
31 #include "libmesh/mesh.h"
32 #include "libmesh/equation_systems.h"
33 #include "libmesh/numeric_vector.h"
34 #include "libmesh/tecplot_io.h"
35 #include "libmesh/threads.h"
36 #include "libmesh/node.h"
48 std::vector<Point> & pts,
49 const Real max_range = 10)
51 libMesh::out <<
"Generating "<< Npts <<
" point cloud...";
54 for (
size_t i=0;i<Npts;i++)
56 pts[i](0) = max_range * (std::rand() % 1000) /
Real(1000);
57 pts[i](1) = max_range * (std::rand() % 1000) /
Real(1000);
58 pts[i](2) = max_range * (std::rand() % 1000) /
Real(1000);
104 const std::string & system_name)
116 int main(
int argc,
char ** argv)
119 libmesh_example_requires(3 <= LIBMESH_DIM,
"3D support");
120 #ifndef LIBMESH_HAVE_EIGEN
121 libmesh_example_requires(
false,
"--enable-eigen");
123 #ifndef LIBMESH_HAVE_ZLIB_H
124 libmesh_example_requires(
false,
"--enable-zlib");
127 #ifdef LIBMESH_DEFAULT_TRIPLE_PRECISION
128 libmesh_example_requires(
false,
"--disable-triple-precision");
130 #ifdef LIBMESH_DEFAULT_QUADRUPLE_PRECISION
131 libmesh_example_requires(
false,
"--disable-quadruple-precision");
139 std::vector<Point> tgt_pts;
140 std::vector<Number> tgt_data_idi, tgt_data_rbi;
141 std::vector<std::string> field_vars;
143 field_vars.push_back(
"u");
144 field_vars.push_back(
"v");
153 rbi.set_field_variables (field_vars);
156 idi.get_source_points());
161 const std::vector<Point> & src_pts (idi.get_source_points());
162 std::vector<Number> & src_vals (idi.get_source_vals());
164 src_vals.clear(); src_vals.reserve(2*src_pts.size());
166 for (std::vector<Point>::const_iterator pt_it=src_pts.begin();
167 pt_it != src_pts.end(); ++pt_it)
175 rbi.get_source_points() = idi.get_source_points();
176 rbi.get_source_vals() = idi.get_source_vals();
178 idi.prepare_for_use();
179 rbi.prepare_for_use();
190 idi.interpolate_field_data (field_vars,
194 rbi.interpolate_field_data (field_vars,
198 std::vector<Number>::const_iterator
199 v_idi = tgt_data_idi.begin(),
200 v_rbi = tgt_data_rbi.begin();
202 for (std::vector<Point>::const_iterator p_it=tgt_pts.begin();
203 p_it!=tgt_pts.end(); ++p_it)
206 <<
"\n u_interp_idi=" << *v_idi
207 <<
", u_interp_rbi=" << *v_rbi
212 <<
", v_interp_rbi=" << *v_rbi
226 mesh_a.
read(
"struct.ucd.gz");
227 mesh_b.read(
"unstruct.ucd.gz");
231 es_a(mesh_a), es_b(mesh_b);
237 sys_b.add_variable (
"Cp",
FIRST);
251 std::vector<Point> & src_pts (idi.get_source_points());
252 std::vector<Number> & src_vals (idi.get_source_vals());
253 std::vector<std::string> field_vars;
254 field_vars.push_back(
"Cp");
259 for (
const auto & node : mesh_a.local_node_ptr_range())
261 src_pts.push_back(*node);
265 rbi.set_field_variables(field_vars);
266 rbi.get_source_points() = idi.get_source_points();
267 rbi.get_source_vals() = idi.get_source_vals();
270 idi.prepare_for_use();
271 rbi.prepare_for_use();
282 sys_b.project_solution (&mif);
297 sys_b.project_solution (&mif);