本文整理汇总了C++中MyMesh::add_point方法的典型用法代码示例。如果您正苦于以下问题:C++ MyMesh::add_point方法的具体用法?C++ MyMesh::add_point怎么用?C++ MyMesh::add_point使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyMesh
的用法示例。
在下文中一共展示了MyMesh::add_point方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
// Begin main function
int main (int argc, char** argv){
//PerfLog P("Example 2 Program");
//P.push("init","Program Initilization");
// Gather command-line options
UserOptions user = gather_command_line(argc, argv);
// Initialize libraries
LibMeshInit init (argc, argv);
// Initilize the mesh and order variables
MyMesh mesh;
Order order;
// Patch test (Bhatti Example 8-1)
if(user.get_flag("patch")){
GMVIO(mesh).read("../data/fem/examples/input/example2.gmv");
mesh.all_first_order();
order = FIRST;
// 2-D box
} else if (user.get_flag("2D")){
MeshTools::Generation::build_square(mesh, 10, 10, 0., 0.04, 0., 0.04, TRI6);
mesh.all_second_order();
order = SECOND;
// 3-D box
} else if (user.get_flag("3D")){
MeshTools::Generation::build_cube(mesh, 10, 10, 10, 0., 0.04, 0., 0.04, 0., 0.04, TET10);
mesh.all_second_order();
order = SECOND;
// Multi-element implementation of Bhatti Exmample 8-1
} else {
mesh.set_mesh_dimension(2);
mesh.add_point(Point(0,0));
mesh.add_point(Point(0.02,0));
mesh.add_point(Point(0.02,0.04));
mesh.add_point(Point(0,0.02));
TriangleInterface t(mesh);
t.desired_area() = 1e-4;
t.triangulation_type() = TriangleInterface::PSLG;
t.smooth_after_generating() = true;
t.triangulate();
mesh.all_second_order();
order = SECOND;
}
// Create an equation system
EquationSystems eq_sys(mesh);
// Create a HeatEq class
boost::shared_ptr<HeatEq> heateq(new HeatEq(eq_sys, order));
// Define the material constants
heateq->system().set_constant<Real>("k", user.get<Real>("conductivity"));
heateq->system().set_constant<Real>("rho", user.get<Real>("density"));
heateq->system().set_constant<Real>("cp", user.get<Real>("specific-heat"));
// Link to the initialization function
heateq->system().add_initial_function(initial_function);
// Add boundary IDs (this is some custom functionality that I added)
mesh.find_neighbors();
mesh.boundary_info->clear();
mesh.add_boundary_id(0, "y", 0.0); // bottom
mesh.add_boundary_id(1, "x", 0.02); // right
mesh.add_boundary_id(2, "x", 0.0); // left
mesh.add_boundary_id(3); // top
// Convection boundary at bottom (user-specified)
pConvection pC = heateq->system().add_boundary<HeatEqBoundaryConvection>(0);
pC->h_constant = user.get<Real>("h-coefficient");
pC->Tinf_constant = user.get<Real>("Tinf");
// Flux boundary at right-side (user-specified)
pNeumann pN = heateq->system().add_boundary<HeatEqBoundaryNeumann>(1);
pN->q_constant = user.get<Real>("flux");
// Flux boundary at left-side (symetry; defaults to q = 0)
heateq->system().add_boundary<HeatEqBoundaryNeumann>(2);
// Top constant temperature boundary
pDirichlet pD = heateq->system().add_boundary<HeatEqBoundaryDirichlet>(3);
pD->fptr = dirichlet_function; // links the boundary function
// Initialize system
heateq->system().init(0.0);
// Define a general filename
FileParts outfile("../data/fem/examples/output/example2.ex2");
// Export the initial mesh
//ExodusII_IO(mesh).write_equation_systems(outfile.add_tstep(0,3,"_"), eq_sys);
MyVTKIO vtk("../data/fem/examples/output/example2.vtu", eq_sys);
vtk.write(0.0);
// Define time stepping variables
//.........这里部分代码省略.........