本文整理汇总了C++中fem::field::CFieldWorld::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ CFieldWorld::Clear方法的具体用法?C++ CFieldWorld::Clear怎么用?C++ CFieldWorld::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fem::field::CFieldWorld
的用法示例。
在下文中一共展示了CFieldWorld::Clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetNewProblem
void SetNewProblem()
{
const unsigned int nprob = 2;
static unsigned int iprob = 0;
static int id_val_bc0=0, id_val_bc1=0, id_val_bc2=0;
if( iprob == 0 ){ // 2次元問題の設定
Cad::CCadObj2D cad_2d;
{ // 形を作る
std::vector<Com::CVector2D> vec_ary;
vec_ary.push_back( Com::CVector2D(-0.5,-0.5) );
vec_ary.push_back( Com::CVector2D( 0.5,-0.5) );
vec_ary.push_back( Com::CVector2D( 0.5, 0.5) );
vec_ary.push_back( Com::CVector2D(-0.5, 0.5) );
cad_2d.AddPolygon( vec_ary );
cad_2d.AddVertex(Cad::LOOP,1,Com::CVector2D(0.0,0.0));
}
world.Clear();
const unsigned int id_base = world.AddMesh( Msh::CMesher2D(cad_2d,0.05) );
const Fem::Field::CIDConvEAMshCad& conv = world.GetIDConverter(id_base);
unsigned int id_field_rot = world.MakeField_FieldElemDim(id_base,2,VECTOR2,VALUE,CORNER);
unsigned int id_field_deflect = world.MakeField_FieldElemDim(id_base,2,SCALAR,VALUE,CORNER);
Fem::Ls::CLinearSystem_Field ls;
LsSol::CPreconditioner_ILU prec;
ls.AddPattern_Field(id_field_deflect,world);
ls.AddPattern_Field(id_field_rot,id_field_deflect,world);
prec.SetLinearSystem(ls.m_ls);
unsigned int id_field_rot_fix0 = world.GetPartialField(id_field_rot,conv.GetIdEA_fromCad(2,Cad::EDGE));
unsigned int id_field_rot_fix1 = world.GetPartialField(id_field_rot,conv.GetIdEA_fromCad(4,Cad::EDGE));
ls.SetFixedBoundaryCondition_Field(id_field_rot_fix0,world);
ls.SetFixedBoundaryCondition_Field(id_field_rot_fix1,world);
unsigned int id_field_def_fix0 = world.GetPartialField(id_field_deflect,conv.GetIdEA_fromCad(2,Cad::EDGE));
unsigned int id_field_def_fix1 = world.GetPartialField(id_field_deflect,conv.GetIdEA_fromCad(4,Cad::EDGE));
Fem::Field::SetFieldValue_Constant(id_field_rot_fix1,1,Fem::Field::VALUE,world, -1);
ls.SetFixedBoundaryCondition_Field(id_field_def_fix0,world);
ls.SetFixedBoundaryCondition_Field(id_field_def_fix1,world);
ls.InitializeMarge();
Fem::Eqn::AddLinearSystem_DKT2D_Static(ls,world,id_field_deflect,id_field_rot);
double res = ls.FinalizeMarge();
prec.SetValue(ls.m_ls);
std::cout << "Residual : " << res << std::endl;
{
double tol = 1.0e-6;
unsigned int iter = 10000;
LsSol::Solve_CG(tol,iter,ls);
// Fem::Sol::Solve_PCG(tol,iter,ls,prec);
std::cout << iter << " " << tol << std::endl;
}
ls.UpdateValueOfField(id_field_deflect,world,VALUE);
ls.UpdateValueOfField(id_field_rot,world,VALUE);
drawer_ary.Clear();
// drawer_ary.PushBack( new View::CDrawerVector(id_field_rot,world) );
drawer_ary.PushBack( new View::CDrawerFace(id_field_deflect,false,world) );
drawer_ary.PushBack( new View::CDrawerEdge(id_field_deflect,false,world) );
drawer_ary.PushBack( new View::CDrawerEdge(id_field_deflect,true,world) );
camera.Fit( drawer_ary.GetBoundingBox(camera.GetRotMatrix3() ) );
}
else if( iprob == 1 ){
Msh::CMesher2D msh;
msh.ReadFromFile_GiDMsh("../input_file/rect_tri.msh");
world.Clear();
const unsigned int id_base = world.AddMesh( msh );
unsigned int id_field_rot = world.MakeField_FieldElemDim(id_base,2, VECTOR2,VALUE,CORNER);
unsigned int id_field_deflect = world.MakeField_FieldElemDim(id_base,2, SCALAR,VALUE,CORNER);
unsigned int id_field_rot_fix0 = world.GetPartialField(id_field_rot,3);
unsigned int id_field_rot_fix1 = world.GetPartialField(id_field_rot,4);
unsigned int id_field_def_fix0 = world.GetPartialField(id_field_deflect,3);
unsigned int id_field_def_fix1 = world.GetPartialField(id_field_deflect,4);
Fem::Field::SetFieldValue_Constant(id_field_def_fix1,0,Fem::Field::VALUE,world, -3);
Fem::Ls::CLinearSystem_Field ls;
LsSol::CPreconditioner_ILU prec;
ls.AddPattern_Field(id_field_deflect,world);
ls.AddPattern_Field(id_field_rot,id_field_deflect,world);
prec.SetLinearSystem(ls.m_ls);
ls.SetFixedBoundaryCondition_Field(id_field_rot_fix0,world);
ls.SetFixedBoundaryCondition_Field(id_field_rot_fix1,world);
ls.SetFixedBoundaryCondition_Field(id_field_def_fix0,world);
ls.SetFixedBoundaryCondition_Field(id_field_def_fix1,world);
ls.InitializeMarge();
Fem::Eqn::AddLinearSystem_DKT2D_Static(ls,world,id_field_deflect,id_field_rot);
double res = ls.FinalizeMarge();
prec.SetValue(ls.m_ls);
std::cout << "Residual : " << res << std::endl;
{
double tol = 1.0e-6;
//.........这里部分代码省略.........