本文整理汇总了C++中MeshReaderH2DXML::save方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshReaderH2DXML::save方法的具体用法?C++ MeshReaderH2DXML::save怎么用?C++ MeshReaderH2DXML::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MeshReaderH2DXML
的用法示例。
在下文中一共展示了MeshReaderH2DXML::save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void Continuity<Scalar>::Record::save_mesh(Mesh* mesh)
{
MeshReaderH2DXML reader;
std::stringstream filename;
filename << Continuity<Scalar>::meshFileName << 0 << '_' << (std::string)"t = " << this->time << (std::string)"n = " << this->number << (std::string)".h2d";
reader.save(filename.str().c_str(), mesh);
}
示例2: IOCalculationContinuityException
void CalculationContinuity<Scalar>::Record::save_mesh(Mesh* mesh)
{
MeshReaderH2DXML reader;
std::stringstream filename;
filename << CalculationContinuity<Scalar>::mesh_file_name << 0 << '_' << (std::string)"t = " << this->time << (std::string)"n = " << this->number << (std::string)".h2d";
try
{
reader.save(filename.str().c_str(), mesh);
}
catch(std::exception& e)
{
throw IOCalculationContinuityException(CalculationContinuityException::meshes, IOCalculationContinuityException::output, filename.str().c_str(), e.what());
}
}
示例3: main
int main(int argc, char* argv[])
{
// Load the mesh.
Mesh mesh_whole_domain, mesh_bottom_left_corner, mesh_complement;
Hermes::vector<Mesh*> meshes (&mesh_whole_domain, &mesh_bottom_left_corner, &mesh_complement);
MeshReaderH2DXML mloader;
mloader.load("subdomains.xml", meshes);
// Perform initial mesh refinements (optional).
for(int i = 0; i < INIT_REF_NUM; i++)
for(unsigned int meshes_i = 0; meshes_i < meshes.size(); meshes_i++)
meshes[meshes_i]->refine_all_elements();
mloader.save("subdomains2.xml", meshes);
mloader.load("subdomains2.xml", meshes);
// Initialize essential boundary conditions.
DefaultEssentialBCConst<double> bc_essential_whole_domain(Hermes::vector<std::string>("Bottom Left", "Bottom Right", "Top Left", "Top Right"), 0.0);
EssentialBCs<double> bcs_whole_domain(&bc_essential_whole_domain);
DefaultEssentialBCConst<double> bc_essential_bottom_left_corner(Hermes::vector<std::string>("Bottom Left", "Horizontal Left"), 0.0);
EssentialBCs<double> bcs_bottom_left_corner(&bc_essential_bottom_left_corner);
DefaultEssentialBCConst<double> bc_essential_complement(Hermes::vector<std::string>("Bottom Right", "Top Right", "Top Left", "Horizontal Left", "Vertical Bottom"), 0.0);
EssentialBCs<double> bcs_complement(&bc_essential_complement);
// Create H1 spaces with default shapeset.
H1Space<double> space_whole_domain(&mesh_whole_domain, &bcs_whole_domain, P_INIT);
int ndof_whole_domain = space_whole_domain.get_num_dofs();
H1Space<double> space_bottom_left_corner(&mesh_bottom_left_corner, &bcs_bottom_left_corner, P_INIT);
int ndof_bottom_left_corner = space_bottom_left_corner.get_num_dofs();
H1Space<double> space_complement(&mesh_complement, &bcs_complement, P_INIT);
int ndof_complement = space_complement.get_num_dofs();
if(ndof_whole_domain == 225 && ndof_bottom_left_corner == 56 && ndof_complement == 161)
{
info("Success!");
return TEST_SUCCESS;
}
else
{
info("Failure!");
return TEST_FAILURE;
}
return 0;
}
示例4: main
int main(int argc, char* argv[])
{
// Load the mesh.
MeshSharedPtr mesh_whole_domain(new Mesh), mesh_bottom_left_corner(new Mesh), mesh_complement(new Mesh);
Hermes::vector<MeshSharedPtr> meshes (mesh_bottom_left_corner, mesh_whole_domain, mesh_complement);
MeshReaderH2DXML mloader;
mloader.set_validation(false);
mloader.load("subdomains.xml", meshes);
// Perform initial mesh refinements (optional).
for(int i = 0; i < INIT_REF_NUM; i++)
for(unsigned int meshes_i = 0; meshes_i < meshes.size(); meshes_i++)
meshes[meshes_i]->refine_all_elements();
mloader.save("subdomains2.xml", meshes);
mloader.load("subdomains2.xml", meshes);
// Initialize essential boundary conditions.
DefaultEssentialBCConst<double> bc_essential_whole_domain(Hermes::vector<std::string>("Bottom Left", "Bottom Right", "Top Left", "Top Right"), 0.0);
EssentialBCs<double> bcs_whole_domain(&bc_essential_whole_domain);
DefaultEssentialBCConst<double> bc_essential_bottom_left_corner(Hermes::vector<std::string>("Bottom Left", "Horizontal Left"), 0.0);
EssentialBCs<double> bcs_bottom_left_corner(&bc_essential_bottom_left_corner);
DefaultEssentialBCConst<double> bc_essential_complement(Hermes::vector<std::string>("Bottom Right", "Top Right", "Top Left", "Horizontal Left", "Vertical Bottom"), 0.0);
EssentialBCs<double> bcs_complement(&bc_essential_complement);
// Create H1 spaces with default shapeset.
SpaceSharedPtr<double> space_whole_domain(new H1Space<double>(mesh_whole_domain, &bcs_whole_domain, P_INIT));
int ndof_whole_domain = space_whole_domain->get_num_dofs();
SpaceSharedPtr<double> space_bottom_left_corner(new H1Space<double>(mesh_bottom_left_corner, &bcs_bottom_left_corner, P_INIT));
int ndof_bottom_left_corner = space_bottom_left_corner->get_num_dofs();
SpaceSharedPtr<double> space_complement(new H1Space<double>(mesh_complement, &bcs_complement, P_INIT));
int ndof_complement = space_complement->get_num_dofs();
if(ndof_whole_domain == 225 && ndof_bottom_left_corner == 56 && ndof_complement == 161)
{
return 0;
}
else
{
return -1;
}
return 0;
}