本文整理汇总了C++中MatrixFr::block方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixFr::block方法的具体用法?C++ MatrixFr::block怎么用?C++ MatrixFr::block使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatrixFr
的用法示例。
在下文中一共展示了MatrixFr::block方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run_tetgen
bool PeriodicExploration::run_tetgen(Float max_tet_vol) {
const size_t dim = m_vertices.cols();
const size_t num_vertices = m_vertices.rows();
TetgenWrapper tetgen(m_vertices, m_faces);
std::stringstream flags;
if (max_tet_vol == 0.0) {
max_tet_vol =
pow(m_default_thickness * pow(0.5, m_refine_order), dim);
}
flags << "pqYQa" << max_tet_vol;
try {
tetgen.run(flags.str());
} catch (TetgenException& e) {
save_mesh("tetgen_debug.msh");
std::cerr << "Tetgen failed! Flags: " << flags.str() << std::endl;
std::cerr << e.what() << std::endl;
std::cerr << "Data saved in tetgen_debug.msh" << std::endl;
return false;
}
// Important note:
//
// The following code is based on rather shaky the observation that tetgen
// will only append to the existing list of vertices. Therefore, the face
// arrays are still valid given the "Y" flag is used.
MatrixFr vertices = tetgen.get_vertices();
assert(vertices.rows() > 0);
assert((vertices.block(0, 0, num_vertices, dim).array()==m_vertices.array()).all());
m_vertices = vertices;
m_voxels = tetgen.get_voxels();
const size_t num_vol_vertices = m_vertices.rows();
for (auto& velocity : m_shape_velocities) {
velocity.conservativeResize(num_vol_vertices, dim);
velocity.block(num_vertices, 0,
num_vol_vertices-num_vertices, dim).setZero();
}
update_mesh();
return true;
}