本文整理汇总了C++中mesquite::MeshImpl::vertices_get_fixed_flag方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshImpl::vertices_get_fixed_flag方法的具体用法?C++ MeshImpl::vertices_get_fixed_flag怎么用?C++ MeshImpl::vertices_get_fixed_flag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mesquite::MeshImpl
的用法示例。
在下文中一共展示了MeshImpl::vertices_get_fixed_flag方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_vertex_is_fixed
void test_vertex_is_fixed()
{
size_t nbVert = mVertices.size();
bool correct_fixed[9] = {false, false, false, true, true, true, true, true, true};
bool fixed[9];
mMesh->vertices_get_fixed_flag( &mVertices[0], fixed, 9, mErr );
CPPUNIT_ASSERT(!mErr);
for (size_t i=0; i<nbVert; ++i) {
CPPUNIT_ASSERT(fixed[i] == correct_fixed[i]);
}
}
示例2: test_vertex_is_fixed
void test_vertex_is_fixed()
{
size_t nbVert = mVertices.size();
bool correct_fixed[9] = {false, false, false, true, true, true, true, true, true};
std::vector<bool> fixed;
mMesh->vertices_get_fixed_flag( arrptr(mVertices), fixed, 9, mErr );
CPPUNIT_ASSERT(!mErr);
CPPUNIT_ASSERT_EQUAL( (size_t)8, fixed.size() );
for (size_t i=0; i<nbVert; ++i) {
CPPUNIT_ASSERT_EQUAL(correct_fixed[i], (bool)fixed[i]);
}
}
示例3: main
int main(int argc, char* argv[])
{
const char* input_file = DEFAULT_INPUT;
const char* output_file = NULL;
switch (argc) {
default:
help(argv[0]);
case 3:
if (!strcmp(argv[2],"-h"))
help(argv[0]);
output_file = argv[2];
case 2:
if (!strcmp(argv[1],"-h"))
help(argv[0]);
input_file = argv[1];
case 1:
;
}
/* Read a VTK Mesh file */
MsqPrintError err(cout);
Mesquite::MeshImpl mesh;
mesh.read_vtk( input_file, err);
if (err) return 1;
// creates an intruction queue
InstructionQueue queue1;
// creates a mean ratio quality metric ...
ConditionNumberQualityMetric shape_metric;
EdgeLengthQualityMetric lapl_met;
lapl_met.set_averaging_method(QualityMetric::RMS);
// creates the laplacian smoother procedures
LaplacianSmoother lapl1;
QualityAssessor stop_qa=QualityAssessor(&shape_metric);
stop_qa.add_quality_assessment(&lapl_met);
//**************Set stopping criterion****************
TerminationCriterion sc2;
sc2.add_iteration_limit( 10 );
if (err) return 1;
lapl1.set_outer_termination_criterion(&sc2);
// adds 1 pass of pass1 to mesh_set1
queue1.add_quality_assessor(&stop_qa,err);
if (err) return 1;
queue1.set_master_quality_improver(&lapl1, err);
if (err) return 1;
queue1.add_quality_assessor(&stop_qa,err);
if (err) return 1;
// adds 1 passes of pass2 to mesh_set1
// mesh_set1.add_quality_pass(pass2);
//writeVtkMesh("original_mesh", mesh, err); MSQ_CHKERR(err);
PlanarDomain plane(Vector3D(0,0,1), Vector3D(0,0,5));
// launches optimization on mesh_set1
MeshDomainAssoc mesh_and_domain = MeshDomainAssoc(&mesh, &plane);
Timer t;
queue1.run_instructions(&mesh_and_domain, err);
if (err) return 1;
double secs = t.since_birth();
std::cout << "Optimization completed in " << secs << " seconds" << std::endl;
if (output_file) {
mesh.write_vtk(output_file, err);
if (err) return 1;
std::cout << "Wrote file: " << output_file << std::endl;
}
// check that smoother is working:
// the one free vertex must be at the origin
if (input_file == DEFAULT_INPUT) {
std::vector<Mesh::VertexHandle> vertices;
mesh.get_all_vertices( vertices, err );
if (err) return 1;
std::vector<bool> fixed_flags;
mesh.vertices_get_fixed_flag( arrptr(vertices), fixed_flags, vertices.size(), err );
if (err) return 1;
// find one free vertex
int idx = -1;
for (unsigned i = 0; i < vertices.size(); ++i) {
if (fixed_flags[i] == true)
continue;
if (idx != -1) {
std::cerr << "Multiple free vertices in mesh." << std::endl;
return 1;
}
idx = i;
}
if (idx == -1) {
std::cerr << "No free vertex in mesh!!!!!" << std::endl;
return 1;
}
//.........这里部分代码省略.........