本文整理汇总了C++中CFieldWorld::GetNA方法的典型用法代码示例。如果您正苦于以下问题:C++ CFieldWorld::GetNA方法的具体用法?C++ CFieldWorld::GetNA怎么用?C++ CFieldWorld::GetNA使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFieldWorld
的用法示例。
在下文中一共展示了CFieldWorld::GetNA方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddPattern_Field
// 対角にパターンを追加
bool CZLinearSystem::AddPattern_Field(const unsigned int id_field, const CFieldWorld& world)
{
if( !world.IsIdField(id_field) ) return false;
const CField& field = world.GetField(id_field);
unsigned int id_field_parent;
{
if( field.GetIDFieldParent() == 0 ){ id_field_parent = id_field; }
else{ id_field_parent = field.GetIDFieldParent(); }
}
unsigned int nlen_value;
{ // 複素数の場合は2で割る
const unsigned int nlen = field.GetNLenValue();
assert( nlen % 2 == 0 );
nlen_value = nlen / 2;
}
int ESType2iLS[3];
{ // Bubbleブロックを作る
unsigned int id_na_val = field.GetNodeSegInNodeAry(BUBBLE).id_na_va;
if( id_na_val != 0 ){
assert( world.IsIdNA(id_na_val) );
const CNodeAry& na = world.GetNA(id_na_val);
CLinSysSeg seg;
{
seg.id_field = id_field_parent; seg.node_config = BUBBLE;
seg.len=nlen_value; seg.nnode=na.Size();
}
ESType2iLS[2] = this->AddLinSysSeg(seg);
}
else{ ESType2iLS[2] = -1; }
}
{ // Edgeブロックを作る
unsigned int id_na_val = field.GetNodeSegInNodeAry(EDGE).id_na_va;
if( id_na_val != 0 ){
assert( world.IsIdNA(id_na_val) );
const CNodeAry& na = world.GetNA(id_na_val);
CLinSysSeg seg;
{
seg.id_field = id_field_parent; seg.node_config = EDGE;
seg.len=nlen_value; seg.nnode=na.Size();
}
ESType2iLS[1] = this->AddLinSysSeg(seg);
}
else{ ESType2iLS[1] = -1; }
}
{ // Cornerブロックを作る
unsigned int id_na_val = field.GetNodeSegInNodeAry(CORNER).id_na_va;
if( id_na_val != 0 ){
assert( world.IsIdNA(id_na_val) );
const CNodeAry& na = world.GetNA(id_na_val);
CLinSysSeg seg;
{
seg.id_field = id_field_parent; seg.node_config = CORNER;
seg.len=nlen_value; seg.nnode=na.Size();
}
ESType2iLS[0] = this->AddLinSysSeg(seg);
}
else{ ESType2iLS[0] = -1; }
}
////////////////////////////////
const std::vector<unsigned int> aIdEA = field.GetAryIdEA();
if( aIdEA.size() == 0 ){ // 剛体モードのための行列
unsigned int ils0 = ESType2iLS[0];
if( m_Matrix_Dia[ils0] == 0 ){
m_Matrix_Dia[ils0] = new CZMatDia_BlkCrs(1, nlen_value);
}
return true;
}
for(unsigned int iiea=0;iiea<aIdEA.size();iiea++)
{
const unsigned int id_ea = aIdEA[iiea];
const CElemAry& ea = world.GetEA(id_ea);
// CORNER節点について
if( field.GetIdElemSeg(id_ea,CORNER,true,world) != 0 ){
assert( world.IsIdEA(id_ea) );
const unsigned int id_es_c = field.GetIdElemSeg(id_ea,CORNER,true,world);
assert( ea.IsSegID(id_es_c) );
const unsigned int ils0 = ESType2iLS[0];
this->AddMat_Dia(ils0, ea, id_es_c ); // cc行列を作る
if( field.GetIdElemSeg(id_ea,BUBBLE,true,world) != 0 ){ // CORNER-BUBBLE
const unsigned int id_es_b = field.GetIdElemSeg(id_ea,BUBBLE,true,world);
assert( ea.IsSegID(id_es_b) );
const unsigned int ils1 = ESType2iLS[2];
Com::CIndexedArray crs;
ea.MakePattern_FEM(id_es_c,id_es_b,crs);
assert( crs.CheckValid() );
this->AddMat_NonDia(ils0,ils1, crs); // cb行列を作る
const unsigned int nnode1 = m_aSeg[ils1].nnode;
Com::CIndexedArray crs_inv;
crs_inv.SetTranspose(nnode1,crs);
this->AddMat_NonDia(ils1,ils0, crs_inv); // bc行列を作る
}
if( field.GetIdElemSeg(id_ea,EDGE,true,world) != 0 ){ // CONRER-EDGE
const unsigned int id_es_e = field.GetIdElemSeg(id_ea,EDGE,true,world);
assert( ea.IsSegID(id_es_e) );
const unsigned int ils1 = ESType2iLS[1];
Com::CIndexedArray crs;
//.........这里部分代码省略.........
示例2: TriArea
static bool AddLinSys_AdvectionDiffusion_Static_P1P1(
double myu, double source,
CLinearSystem_Field& ls,
const unsigned int id_field_val, const unsigned int id_field_velo, const CFieldWorld& world,
unsigned int id_ea )
{
// std::cout << "Advection Diffusion Static 2D Triangle 3-point 1st order" << std::endl;
assert( world.IsIdEA(id_ea) );
const CElemAry& ea = world.GetEA(id_ea);
assert( ea.ElemType() == TRI );
if( !world.IsIdField(id_field_val) ) return false;
const CField& val_field = world.GetField(id_field_val);
if( !world.IsIdField(id_field_velo) ) return false;
const CField& field_velo = world.GetField(id_field_velo);
// 角節点の節点配列ID
unsigned int id_na_c_co = val_field.GetNodeSegInNodeAry(CORNER).id_na_co;
unsigned int id_ns_c_co = val_field.GetNodeSegInNodeAry(CORNER).id_ns_co;
unsigned int id_na_c_val = val_field.GetNodeSegInNodeAry(CORNER).id_na_va;
unsigned int id_ns_c_val = val_field.GetNodeSegInNodeAry(CORNER).id_ns_va;
unsigned int id_na_c_velo = field_velo.GetNodeSegInNodeAry(CORNER).id_na_va;
unsigned int id_ns_c_velo = field_velo.GetNodeSegInNodeAry(CORNER).id_ns_ve;
assert( id_na_c_co != 0 && id_ns_c_co != 0 );
assert( id_na_c_val != 0 && id_ns_c_val != 0 );
assert( id_na_c_velo != 0 );
assert( id_ns_c_velo != 0 );
const unsigned int nno = 3;
const unsigned int ndim = 2;
const CElemAry::CElemSeg& es_c_val = field_velo.GetElemSeg(id_ea,CORNER,true,world);
unsigned int no_c[nno]; // 要素節点の全体節点番号
double value_c[nno]; // 要素節点の値
double coord_c[nno][ndim]; // 要素節点の座標
double velo_c[nno][ndim];
double emat[nno][nno]; // 要素剛性行列
double eres_c[nno]; // 要素節点等価内力、外力、残差ベクトル
CMatDia_BlkCrs& mat_cc = ls.GetMatrix( id_field_val,CORNER,world);
CVector_Blk& res_c = ls.GetResidual(id_field_val,CORNER,world);
const CNodeAry& na_c_val = world.GetNA(id_na_c_val);
const CNodeAry::CNodeSeg& ns_c_val = na_c_val.GetSeg(id_ns_c_val);
const CNodeAry& na_c_velo = world.GetNA(id_na_c_velo);
const CNodeAry::CNodeSeg& ns_c_velo = na_c_velo.GetSeg(id_ns_c_velo);
const CNodeAry& na_c_co = world.GetNA(id_na_c_co);
const CNodeAry::CNodeSeg& ns_c_co = na_c_co.GetSeg(id_ns_c_co);
for(unsigned int ielem=0;ielem<ea.Size();ielem++)
{
// 要素配列から要素セグメントの節点番号を取り出す
es_c_val.GetNodes(ielem,no_c);
// 節点の値を取って来る
for(unsigned int inoes=0;inoes<nno;inoes++){
ns_c_co.GetValue(no_c[inoes],coord_c[inoes]);
ns_c_val.GetValue(no_c[inoes],&value_c[inoes]);
ns_c_velo.GetValue(no_c[inoes],velo_c[inoes]);
}
////////////////////////////////////////////////////////////////
// 面積を求める
const double area = TriArea(coord_c[0],coord_c[1],coord_c[2]);
// 形状関数の微分を求める
double dldx[nno][ndim]; // 形状関数のxy微分
double const_term[nno]; // 形状関数の定数項
TriDlDx(dldx,const_term,coord_c[0],coord_c[1],coord_c[2]);
// 要素剛性行列を作る
for(unsigned int ino=0;ino<nno;ino++){
for(unsigned int jno=0;jno<nno;jno++){
emat[ino][jno] = myu*area*(dldx[ino][0]*dldx[jno][0]+dldx[ino][1]*dldx[jno][1]);
}
}
{
const double dtmp1 = area*0.08333333333333333333333;
for(unsigned int ino=0;ino<nno;ino++){
const double dtmp_0 = dtmp1*(velo_c[0][0]+velo_c[1][0]+velo_c[2][0]+velo_c[ino][0]);
const double dtmp_1 = dtmp1*(velo_c[0][1]+velo_c[1][1]+velo_c[2][1]+velo_c[ino][1]);
for(unsigned int jno=0;jno<nno;jno++){
emat[ino][jno] += dldx[jno][0]*dtmp_0+dldx[jno][1]*dtmp_1;
}
}
}
// Calc Stabilization Parameter
double tau;
{
const double velo_ave[2] = {
(velo_c[0][0]+velo_c[1][0]+velo_c[2][0])/3.0,
(velo_c[0][1]+velo_c[1][1]+velo_c[2][1])/3.0 };
const double norm_v = sqrt(velo_ave[0]*velo_ave[0]+velo_ave[1]*velo_ave[1]);
const double velo_dir[2] = { velo_ave[0]/norm_v, velo_ave[1]/norm_v };
//.........这里部分代码省略.........