本文整理汇总了C++中meshlib::Mesh::getNode方法的典型用法代码示例。如果您正苦于以下问题:C++ Mesh::getNode方法的具体用法?C++ Mesh::getNode怎么用?C++ Mesh::getNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类meshlib::Mesh
的用法示例。
在下文中一共展示了Mesh::getNode方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nNodes
void testZCoords2D(MeshLib::Mesh const& input, MeshLib::Mesh const& output, double height)
{
std::size_t const nNodes (input.getNumberOfNodes());
for (std::size_t i=0; i<nNodes; ++i)
{
ASSERT_EQ((*input.getNode(i))[2], (*output.getNode(i))[2]);
ASSERT_EQ((*input.getNode(i))[2] + height, (*output.getNode(nNodes+i))[2]);
}
}
示例2: normal
// Project to parallels of YZ plane
TEST_F(ProjectionTest, ProjectToYZ)
{
MathLib::Vector3 normal (1,0,0);
std::size_t const n_nodes (_mesh->getNumberOfNodes());
for (std::size_t p=0; p<10; p++)
{
MathLib::Point3d origin (std::array<double,3>{{static_cast<double>(p),0,0}});
MeshLib::Mesh* result = MeshLib::projectMeshOntoPlane(*_mesh, origin, normal);
for (std::size_t i=0; i<n_nodes; i++)
ASSERT_NEAR(static_cast<double>(p), (*result->getNode(i))[0], std::numeric_limits<double>::epsilon());
delete result;
}
}
示例3: func
std::vector<double> generateNodeValueDistribution(
const NumLib::ISpatialFunction &func,
const MeshLib::Mesh &msh,
const std::vector<std::size_t> &vec_node_ids)
{
// evaluate a given function with nodal coordinates
std::vector<double> vec_values(vec_node_ids.size());
std::transform(vec_node_ids.begin(), vec_node_ids.end(), vec_values.begin(),
[&func, &msh](std::size_t node_id)
{
return func(*msh.getNode(node_id));
});
return vec_values;
}
示例4: origin
// Length of normal does not matter (it's normalised within the method)
TEST_F(ProjectionTest, NormalLength)
{
MathLib::Point3d origin (std::array<double,3>{{0,0,0}});
MathLib::Vector3 normal (0,0,1);
std::size_t const n_nodes (_mesh->getNumberOfNodes());
MeshLib::Mesh* result = MeshLib::projectMeshOntoPlane(*_mesh, origin, normal);
for (std::size_t p=2; p<10; p++)
{
normal[2] = static_cast<double>(p);
MeshLib::Mesh* result_p = MeshLib::projectMeshOntoPlane(*_mesh, origin, normal);
for (std::size_t i=0; i<n_nodes; i++)
ASSERT_EQ((*result->getNode(i))[2], (*result_p->getNode(i))[2]);
delete result_p;
}
delete result;
}
示例5: createMeshFromSelectedNodes
MeshLib::Mesh createMeshFromSelectedNodes(
MeshLib::Mesh const& mesh, std::vector<std::size_t> const& selected_nodes)
{
// Deep copy of selected nodes from the mesh.
std::vector<MeshLib::Node*> some_nodes;
std::transform(begin(selected_nodes), end(selected_nodes),
back_inserter(some_nodes),
[&mesh](std::size_t const node_id) {
return new MeshLib::Node(*mesh.getNode(node_id));
});
// The resulting mesh without elements containing the selected nodes.
MeshLib::Mesh result("boundary_mesh", some_nodes, {});
addPropertyToMesh(result, "bulk_node_ids", MeshLib::MeshItemType::Node, 1,
selected_nodes);
return result;
}
示例6: mesh
TEST(MeshLib, Duplicate)
{
MeshLib::Mesh* mesh (MeshLib::MeshGenerator::generateRegularQuadMesh(10, 5, 1));
std::vector<MeshLib::Node*> new_nodes (MeshLib::copyNodeVector(mesh->getNodes()));
std::vector<MeshLib::Element*> new_elements (MeshLib::copyElementVector(mesh->getElements(), new_nodes));
MeshLib::Mesh new_mesh ("new", new_nodes, new_elements);
ASSERT_EQ (mesh->getNElements(), new_mesh.getNElements());
ASSERT_EQ (mesh->getNNodes(), new_mesh.getNNodes());
std::vector<std::size_t> del_idx(1,1);
MeshLib::removeMeshNodes(*mesh, del_idx);
ASSERT_EQ (mesh->getNElements(), new_mesh.getNElements()-2);
ASSERT_EQ (mesh->getNNodes(), new_mesh.getNNodes()-2);
ASSERT_DOUBLE_EQ (4.0, MathLib::sqrDist(*mesh->getNode(0), *new_mesh.getNode(0)));
ASSERT_DOUBLE_EQ (0.0, MathLib::sqrDist(*mesh->getNode(0), *new_mesh.getNode(2)));
ASSERT_DOUBLE_EQ (4.0, MathLib::sqrDist(*mesh->getElement(0)->getNode(0), *new_mesh.getElement(0)->getNode(0)));
ASSERT_DOUBLE_EQ (0.0, MathLib::sqrDist(*mesh->getElement(0)->getNode(0), *new_mesh.getElement(2)->getNode(0)));
}