本文整理汇总了C++中GetPot::have_section方法的典型用法代码示例。如果您正苦于以下问题:C++ GetPot::have_section方法的具体用法?C++ GetPot::have_section怎么用?C++ GetPot::have_section使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GetPot
的用法示例。
在下文中一共展示了GetPot::have_section方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check_dup_input_style
void AdaptiveTimeSteppingOptions::check_dup_input_style( const GetPot& input ) const
{
if( (input.have_variable("unsteady-solver/target_tolerance") &&
input.have_section("Strategies/AdaptiveTimeStepping/target_tolerance")) ||
(input.have_variable("unsteady-solver/upper_tolerance") &&
input.have_section("Strategies/AdaptiveTimeStepping/upper_tolerance")) ||
(input.have_variable("unsteady-solver/max_growth") &&
input.have_section("Strategies/AdaptiveTimeStepping/max_growth")) )
libmesh_error_msg("ERROR: Cannot use both old and new style of options for AdaptiveTimeSteppingOptions!");
}
示例2: is_new_bc_input_style
bool BCBuilder::is_new_bc_input_style( const GetPot& input )
{
bool new_style = false;
if( input.have_section(BoundaryConditionNames::bc_section()) )
new_style = true;
return new_style;
}
示例3: testSections
void testSections()
{
// GetPot stores the '/' at the end of each section name
CPPUNIT_ASSERT(input.have_section("Section1/"));
CPPUNIT_ASSERT(input.have_section("Section1/SubSection1/"));
CPPUNIT_ASSERT(input.have_section("Section2/Subsection2/"));
CPPUNIT_ASSERT(input.have_section("Section2/Subsection2/Subsection3/"));
CPPUNIT_ASSERT(input.have_section("Section2/Subsection4/"));
CPPUNIT_ASSERT(input.have_section("Section3/"));
// But we don't need to supply the trailing '/'
CPPUNIT_ASSERT(input.have_section("Section1"));
CPPUNIT_ASSERT(input.have_section("Section1/SubSection1"));
CPPUNIT_ASSERT(input.have_section("Section2/Subsection2/Subsection3"));
// No such thing as this section
CPPUNIT_ASSERT(!input.have_section("ImNotASection/"));
}
示例4: check_input_consistency
void ViscosityBase::check_input_consistency( const GetPot& input, const std::string& material ) const
{
// We can't have both the materials version and the old versions
MaterialsParsing::duplicate_input_test(input,
"Materials/"+material+"/Viscosity/value",
"Materials/Viscosity/mu" );
// If the material section exists, but not the variable, this is an error
if( input.have_section("Materials/"+material+"/Viscosity") &&
!input.have_variable("Materials/"+material+"/Viscosity/value") )
{
libmesh_error_msg("Error: Found section Materials/"+material+"/Viscosity, but not variable value.");
}
return;
}
示例5: if
std::shared_ptr<libMesh::UnstructuredMesh> MeshBuilder::build
(const GetPot& input,
const libMesh::Parallel::Communicator &comm)
{
// First check if the user has both old and new versions of mesh input
if( input.have_section("mesh-options/") &&
input.have_section("Mesh/") )
{
libmesh_error_msg("Error: Detected illegal simulataneous use of [mesh-options] and [Mesh] in input!");
}
// User needs to tell us if we are generating or reading a mesh
// We infer this by checking and seeing if the use has a Mesh/Read
// or a Mesh/Generation section
if( !input.have_variable("mesh-options/mesh_option") &&
!input.have_section("Mesh/Read/") &&
!input.have_section("Mesh/Generation/") )
{
libmesh_error_msg("ERROR: Must specify either Mesh/Read or Mesh/Generation in input.");
}
// But you can't have it both ways
if( input.have_section("Mesh/Read/") && input.have_section("Mesh/Generation/") )
{
libmesh_error_msg("ERROR: Can only specify one of Mesh/Read and Mesh/Generation");
}
// Are we generating the mesh or are we reading one in from a file?
std::string mesh_build_type = "NULL";
if( input.have_section("Mesh/Read/") )
mesh_build_type = "read";
else if( input.have_section("Mesh/Generation/") )
mesh_build_type = "generate";
this->deprecated_option<std::string>( input, "mesh-options/mesh_option", "Mesh/Read or Mesh/Generation", "DIE!", mesh_build_type);
// Make sure the user gave a valid option
/*! \todo Can remove last 4 checks once mesh-options/mesh_option support is removed. */
if( mesh_build_type != std::string("generate") &&
mesh_build_type != std::string("read") &&
mesh_build_type != std::string("read_mesh_from_file") &&
mesh_build_type != std::string("create_1D_mesh") &&
mesh_build_type != std::string("create_2D_mesh") &&
mesh_build_type != std::string("create_3D_mesh") )
{
std::string error = "ERROR: Invalid value of "+mesh_build_type+" for Mesh/type.\n";
error += " Valid values are: generate\n";
error += " read\n";
libmesh_error_msg(error);
}
// Create UnstructuredMesh object (defaults to dimension 1).
libMesh::UnstructuredMesh* mesh;
// Were we specifically asked to use a ParallelMesh or SerialMesh?
{
std::string mesh_class = input("Mesh/class", "default");
this->deprecated_option<std::string>( input, "mesh-options/mesh_class", "Mesh/class", "default", mesh_class);
if (mesh_class == "parallel")
mesh = new libMesh::ParallelMesh(comm);
else if (mesh_class == "serial")
mesh = new libMesh::SerialMesh(comm);
else if (mesh_class == "default")
mesh = new libMesh::Mesh(comm);
else
{
std::string error = "ERROR: Invalid class "+mesh_class+" input for Mesh/class.\n";
error += " Valid choices are: serial, parallel.\n";
libmesh_error_msg(error);
}
}
// Read mesh from file
if(mesh_build_type =="read_mesh_from_file" /* This is deprecated */ ||
mesh_build_type == "read" )
{
// Make sure the user set the filename to read
if( !input.have_variable("mesh-options/mesh_filename") /* This is deprecated */ &&
!input.have_variable("Mesh/Read/filename") )
{
libmesh_error_msg("ERROR: Must specify Mesh/Read/filename for reading mesh.");
}
std::string mesh_filename = input("Mesh/Read/filename", "DIE!");
this->deprecated_option<std::string>( input, "mesh-options/mesh_filename", "Mesh/Read/filename", "DIE!", mesh_filename);
// According to Roy Stogner, the only read format
// that won't properly reset the dimension is gmsh.
/*! \todo Need to a check a GMSH meshes */
mesh->read(mesh_filename);
// If we have a first order mesh file but we need second order
// elements we should fix that.
bool all_second_order = input("Mesh/all_second_order", false);
if (all_second_order)
mesh->all_second_order();
//.........这里部分代码省略.........