本文整理汇总了C++中mesquite::MeshImpl::get_all_vertices方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshImpl::get_all_vertices方法的具体用法?C++ MeshImpl::get_all_vertices怎么用?C++ MeshImpl::get_all_vertices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mesquite::MeshImpl
的用法示例。
在下文中一共展示了MeshImpl::get_all_vertices方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[])
{
Mesquite::MsqPrintError err(cout);
Mesquite::MeshImpl mesh;
//mesh->read_exodus("transformed_mesh.exo", err);
mesh.read_vtk(MESH_FILES_DIR "2D/vtk/quads/untangled/tfi_horse10x4-12.vtk", err);
if (err) return 1;
// Get all vertex coordinates from mesh
std::vector<Mesquite::Mesh::VertexHandle> handles;
mesh.get_all_vertices( handles, err );
if (err) return 1;
if (handles.empty()) {
std::cerr << "No verticies in mesh" << endl;
return 1;
}
std::vector<Mesquite::MsqVertex> coords( handles.size() );
mesh.vertices_get_coordinates( arrptr(handles), arrptr(coords), handles.size(), err );
if (err) return 1;
//create the matrix for affine transformation
double array_entries[9];
array_entries[0]=0; array_entries[1]=1; array_entries[2]=0;
array_entries[3]=1; array_entries[4]=0; array_entries[5]=0;
array_entries[6]=0; array_entries[7]=0; array_entries[8]=1;
//create the translation vector
Matrix3D my_mat(array_entries);
Vector3D my_vec(0, 0 , 10);
MeshTransform my_transform(my_mat, my_vec);
//mesh->write_exodus("original_mesh.exo", err);
MeshDomainAssoc mesh_and_domain = MeshDomainAssoc(&mesh, 0);
my_transform.loop_over_mesh(&mesh_and_domain, 0, err);
if (err) return 1;
//mesh->write_exodus("transformed_mesh.exo", err);
mesh.write_vtk("transformed_mesh.vtk", err);
if (err) return 1;
// Get transformed coordinates
std::vector<Mesquite::MsqVertex> coords2( handles.size() );
mesh.vertices_get_coordinates( arrptr(handles), arrptr(coords2), handles.size(), err );
if (err) return 1;
// Compare vertex coordinates
size_t invalid = 0;
std::vector<Mesquite::MsqVertex>::iterator iter, iter2;
iter = coords.begin();
iter2 = coords2.begin();
for ( ; iter != coords.end(); ++iter, ++iter2 )
{
Mesquite::Vector3D xform = my_mat * *iter + my_vec;
double d = (xform - *iter2).length();
if (d > EPSILON)
++invalid;
}
std::cerr << invalid << " vertices not within " << EPSILON
<< " of expected location" << std::endl;
return (invalid != 0);
}
示例2: main
int main(int argc, char* argv[])
{
std::cout << std::endl << "********* Wrappers Timing Tests **********"
<< std::endl << "Version " << version_string(true)
<< std::endl << std::endl;
Mesquite::MsqPrintError err(cout);
Mesquite::MeshImpl mesh;
// #################### Begin ShapeImprover tests ###################
ShapeImprover si_wrapper;
mesh.read_vtk(shape_improv_file_name_1, err);
Timer t;
si_wrapper.run_instructions(&mesh, err);
if (err) return 1;
double si_s_secs = t.since_birth();
std::cout << std::endl << "ShapeImprover small file optimization completed in "
<< si_s_secs << " seconds" << std::endl;
mesh.clear();
mesh.read_vtk(shape_improv_file_name_2, err);
t.reset();
si_wrapper.run_instructions(&mesh, err);
if (err) return 1;
double si_l_secs = t.since_birth();
std::cout << std::endl << "ShapeImprover large file optimization completed in "
<< si_l_secs << " seconds" << std::endl;
// #################### Begin LaplacianWrapper tests ###################
Vector3D pnt1(0,0,5);
Vector3D s_norm(0,0,1);
Mesquite::PlanarDomain msq_geom(s_norm, pnt1);
LaplaceWrapper lp_wrapper;
mesh.clear();
mesh.read_vtk(laplacian_file_name_1, err);
if (err) return 1;
MeshDomainAssoc mesh_and_domain4 = MeshDomainAssoc(&mesh, &msq_geom);
t.reset();
lp_wrapper.run_instructions(&mesh_and_domain4, err);
if (err) return 1;
double lp_s_secs = t.since_birth();
std::cout << std::endl << "LaplacianWrapper small file optimization completed in "
<< lp_s_secs << " seconds" << std::endl;
Vector3D pnt2(0,0,0);
Mesquite::PlanarDomain msq_geom2(s_norm, pnt2);
mesh.clear();
mesh.read_vtk(laplacian_file_name_2, err);
if (err) return 1;
MeshDomainAssoc mesh_and_domain5 = MeshDomainAssoc(&mesh, &msq_geom2);
t.reset();
lp_wrapper.run_instructions(&mesh_and_domain5, err);
if (err) return 1;
double lp_l1_secs = t.since_birth();
std::cout << std::endl << "LaplacianWrapper large file (term crit=0.001) completed in "
<< lp_l1_secs << " seconds" << std::endl;
mesh.clear();
mesh.read_vtk(laplacian_file_name_2, err);
if (err) return 1;
lp_wrapper.set_vertex_movement_limit_factor(0.1);
t.reset();
lp_wrapper.run_instructions(&mesh_and_domain5, err);
if (err) return 1;
double lp_l2_secs = t.since_birth();
std::cout << std::endl << "LaplacianWrapper large file (term crit=0.1) completed in "
<< lp_l2_secs << " seconds" << std::endl;
// #################### Begin UntangleWrapper::BETA tests ###################
mesh.clear();
mesh.read_vtk(untangle_file_name_1, err);
if (err) return 1;
std::vector<Mesh::VertexHandle> verts;
mesh.get_all_vertices( verts, err );
if (err || verts.empty()) return 1;
MsqVertex coords;
mesh.vertices_get_coordinates( arrptr(verts), &coords, 1, err );
if (err) return 1;
Vector3D norm(0,0,1);
PlanarDomain u_domain( norm, coords );
UntangleWrapper::UntangleMetric metric = UntangleWrapper::BETA;
UntangleWrapper un_wrapper (metric);
un_wrapper.set_vertex_movement_limit_factor( 0.005 );
MeshDomainAssoc mesh_and_domain3 = MeshDomainAssoc(&mesh, &u_domain);
//.........这里部分代码省略.........