本文整理汇总了C++中geolib::GEOObjects::getPolylineVec方法的典型用法代码示例。如果您正苦于以下问题:C++ GEOObjects::getPolylineVec方法的具体用法?C++ GEOObjects::getPolylineVec怎么用?C++ GEOObjects::getPolylineVec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类geolib::GEOObjects
的用法示例。
在下文中一共展示了GEOObjects::getPolylineVec方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkPolylineProperties
void checkPolylineProperties()
{
const GeoLib::PolylineVec *line_vec = geo_objects.getPolylineVecObj(geo_name);
auto const readerLines = geo_objects.getPolylineVec(geo_name);
EXPECT_EQ(5u, readerLines->size());
auto checkPolylineProperty = [this](GeoLib::PolylineVec const* line_vec,
std::size_t ply_id, std::vector<std::size_t> pnt_ids,
std::string const& name)
{
auto const lines = geo_objects.getPolylineVec(geo_name);
GeoLib::Polyline* line = (*lines)[ply_id];
EXPECT_EQ(pnt_ids.size(), line->getNumberOfPoints());
for (std::size_t k(0); k<pnt_ids.size(); ++k)
EXPECT_EQ(pnt_ids[k], line->getPointID(k));
std::string line_name;
line_vec->getNameOfElementByID(ply_id, line_name);
EXPECT_EQ(name, line_name);
};
checkPolylineProperty(line_vec, 0, {0, 1, 2}, "left");
checkPolylineProperty(line_vec, 1, {3, 4, 5}, "center");
checkPolylineProperty(line_vec, 2, {0, 3}, "line1");
checkPolylineProperty(line_vec, 3, {3, 6}, "line2");
checkPolylineProperty(line_vec, 4, {6, 7, 8}, "right");
}
示例2: main
int main (int argc, char* argv[])
{
ApplicationsLib::LogogSetup logog_setup;
TCLAP::CmdLine cmd(
"Creates boundary conditions for mesh nodes along polylines."
"The documentation is available at https://docs.opengeosys.org/docs/tools/model-preparation/create-boundary-conditions-along-a-polyline",
' ',
"0.1");
TCLAP::ValueArg<bool> gml_arg("", "gml",
"if switched on write found nodes to file in gml format", false, 0, "bool");
cmd.add(gml_arg);
TCLAP::ValueArg<std::string> output_base_fname("o", "output-base-file-name",
"the base name of the file the output (geometry (gli) and boundary"\
"condition (bc)) will be written to", true,
"", "file name");
cmd.add(output_base_fname);
TCLAP::ValueArg<std::string> bc_type("t", "type",
"the process type the boundary condition will be written for "\
"currently LIQUID_FLOW (primary variable PRESSURE1) and "\
"GROUNDWATER_FLOW (primary variable HEAD, default) are supported", true,
"",
"process type as string (LIQUID_FLOW or GROUNDWATER_FLOW (default))");
cmd.add(bc_type);
TCLAP::ValueArg<double> search_length_arg("s", "search-length",
"The size of the search length. The default value is "
"std::numeric_limits<double>::epsilon()", false,
std::numeric_limits<double>::epsilon(), "floating point number");
cmd.add(search_length_arg);
TCLAP::ValueArg<std::string> geometry_fname("i", "input-geometry",
"the name of the file containing the input geometry", true,
"", "file name");
cmd.add(geometry_fname);
TCLAP::ValueArg<std::string> mesh_arg("m", "mesh-file",
"the name of the file containing the mesh", true,
"", "file name");
cmd.add(mesh_arg);
cmd.parse(argc, argv);
// *** read mesh
INFO("Reading mesh \"%s\" ... ", mesh_arg.getValue().c_str());
MeshLib::Mesh * subsurface_mesh(FileIO::readMeshFromFile(mesh_arg.getValue()));
INFO("done.");
INFO("Extracting top surface of mesh \"%s\" ... ",
mesh_arg.getValue().c_str());
const MathLib::Vector3 dir(0,0,-1);
double const angle(90);
std::unique_ptr<MeshLib::Mesh> surface_mesh(
MeshLib::MeshSurfaceExtraction::getMeshSurface(*subsurface_mesh, dir,
angle));
INFO("done.");
delete subsurface_mesh;
subsurface_mesh = nullptr;
// *** read geometry
GeoLib::GEOObjects geometries;
FileIO::readGeometryFromFile(geometry_fname.getValue(), geometries);
std::string geo_name;
{
std::vector<std::string> geo_names;
geometries.getGeometryNames(geo_names);
geo_name = geo_names[0];
}
// *** check if the data is usable
// *** get vector of polylines
std::vector<GeoLib::Polyline*> const* plys(geometries.getPolylineVec(geo_name));
if (!plys) {
ERR("Could not get vector of polylines out of geometry \"%s\".",
geo_name.c_str());
return -1;
}
MeshGeoToolsLib::SearchLength search_length_strategy;
if (search_length_arg.isSet()) {
search_length_strategy =
MeshGeoToolsLib::SearchLength(search_length_arg.getValue());
}
GeoLib::GEOObjects geometry_sets;
MeshGeoToolsLib::MeshNodeSearcher mesh_searcher(*surface_mesh,
search_length_strategy);
for(std::size_t k(0); k<plys->size(); k++) {
std::vector<std::size_t> ids
(mesh_searcher.getMeshNodeIDsAlongPolyline(*((*plys)[k])));
if (ids.empty())
continue;
std::string geo_name("Polyline-"+std::to_string(k));
convertMeshNodesToGeometry(surface_mesh->getNodes(), ids, geo_name,
geometry_sets);
}
// merge all together
//.........这里部分代码省略.........