当前位置: 首页>>代码示例>>C++>>正文


C++ CFieldWorld::IsIdNA方法代码示例

本文整理汇总了C++中fem::field::CFieldWorld::IsIdNA方法的典型用法代码示例。如果您正苦于以下问题:C++ CFieldWorld::IsIdNA方法的具体用法?C++ CFieldWorld::IsIdNA怎么用?C++ CFieldWorld::IsIdNA使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fem::field::CFieldWorld的用法示例。


在下文中一共展示了CFieldWorld::IsIdNA方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: assert

// add pattern to the diagonal
bool Ls::CLinearSystem_RigidField2::AddPattern_Field(const unsigned int id_field, const Fem::Field::CFieldWorld& world)
{
	if( !world.IsIdField(id_field) ) return false;
  const Fem::Field::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(); }
	}

	const unsigned int nlen_value = field.GetNLenValue();

	int ilss_add;
	{	// Cornerブロックを作る
    unsigned int id_na_val = field.GetNodeSegInNodeAry(Fem::Field::CORNER).id_na_va;
		if( id_na_val != 0 ){
			assert( world.IsIdNA(id_na_val) );
      const Fem::Field::CNodeAry& na = world.GetNA(id_na_val);
      assert( m_ls.GetNLinSysSeg() == this->m_aSegRF.size() );
      ilss_add = m_ls.GetNLinSysSeg();
      this->m_aSegRF.push_back( CLinSysSegRF(id_field_parent,Fem::Field::CORNER) );
      int ires = m_ls.AddLinSysSeg( na.Size(), field.GetNLenValue() );
      assert( ires == ilss_add );
		}
		else{ ilss_add = -1; }
	}
	////////////////////////////////
	const std::vector<unsigned int> aIdEA = field.GetAryIdEA();
  assert( aIdEA.size() > 0 );
	for(unsigned int iiea=0;iiea<aIdEA.size();iiea++){
		const unsigned int id_ea = aIdEA[iiea];
    const Fem::Field::CElemAry& ea = world.GetEA(id_ea);
		// CORNER節点について
    if( field.GetIdElemSeg(id_ea,Fem::Field::CORNER,true,world) != 0 ){
			assert( world.IsIdEA(id_ea) );
      const unsigned int id_es_c = field.GetIdElemSeg(id_ea,Fem::Field::CORNER,true,world);
			assert( ea.IsSegID(id_es_c) );
      {
        Com::CIndexedArray crs;
        ea.MakePattern_FEM(id_es_c,crs);
        m_ls.AddMat_Dia(ilss_add, crs );			// cc行列を作る
      }
      if( field.GetIdElemSeg(id_ea,Fem::Field::BUBBLE,true,world) != 0 ){	// CORNER-BUBBLE
        assert(0);
			}
      if( field.GetIdElemSeg(id_ea,Fem::Field::EDGE,true,world) != 0 ){	// CONRER-EDGE
        assert(0);
			}
		}
		// EDGE節点について
    if( field.GetIdElemSeg(id_ea,Fem::Field::EDGE,true,world) != 0 ){
      assert(0);
		}
		// BUBBLE節点について
    if( field.GetIdElemSeg(id_ea,Fem::Field::BUBBLE,true,world) != 0 ){
      assert(0);
		}
	}
	return true;
}
开发者ID:gabriel-tandil,项目名称:SENSITIVE_COUTURE,代码行数:61,代码来源:linearsystem_rigidfield.cpp

示例2:

//! set random field to the field
void Fem::Field::SetFieldValue_Random
(unsigned int id_field_to, unsigned int idofns, Fem::Field::FIELD_DERIVATION_TYPE fdt, 
 Fem::Field::CFieldWorld& world,
 double ave, double range)
{
  if( !world.IsIdField(id_field_to) ) return;
  Fem::Field::CField field_to = world.GetField(id_field_to);
	srand(0);
	if( field_to.GetNodeSegInNodeAry(CORNER).id_na_va != 0 ){
    const Fem::Field::CField::CNodeSegInNodeAry& m_na_c = field_to.GetNodeSegInNodeAry(CORNER);
		assert( world.IsIdNA(m_na_c.id_na_va) );
		CNodeAry& na = world.GetNA(m_na_c.id_na_va);
		if( !na.IsSegID(m_na_c.id_ns_va) ){
			std::cout << "Valueセグメントがない(速度場に設定しようとしている)" << std::endl;
			std::cout << "そのうちValueセグメントを追加で作る関数を加える" << std::endl;
			assert(0);
		}
		assert( na.IsSegID(m_na_c.id_ns_va) );
		CNodeAry::CNodeSeg& ns_val = na.GetSeg(m_na_c.id_ns_va);
		const unsigned int nnode = na.Size();
		for(unsigned int inode=0;inode<nnode;inode++){
			ns_val.SetValue(inode,0,rand()*2.0/(1.0+RAND_MAX)-1.0);
		}
	}
  if( field_to.GetNodeSegInNodeAry(EDGE).id_na_va != 0 ){
    const Fem::Field::CField::CNodeSegInNodeAry& m_na_e = field_to.GetNodeSegInNodeAry(EDGE);
		assert( world.IsIdNA(m_na_e.id_na_va) );
		CNodeAry& na = world.GetNA(m_na_e.id_na_va);
		assert( na.IsSegID(m_na_e.id_ns_va) );
		CNodeAry::CNodeSeg& ns_val = na.GetSeg(m_na_e.id_ns_va);
		const unsigned int nnode = na.Size();
		for(unsigned int inode=0;inode<nnode;inode++){
			ns_val.SetValue(inode,0,rand()*2.0/(1.0+RAND_MAX)-1.0);
		}
	}
  if( field_to.GetNodeSegInNodeAry(BUBBLE).id_na_va != 0 ){
    const Fem::Field::CField::CNodeSegInNodeAry& m_na_b = field_to.GetNodeSegInNodeAry(BUBBLE);  
		assert( world.IsIdNA(m_na_b.id_na_va) );
		CNodeAry& na = world.GetNA(m_na_b.id_na_va);
		assert( na.IsSegID(m_na_b.id_ns_va) );
		CNodeAry::CNodeSeg& ns_val = na.GetSeg(m_na_b.id_ns_va);
		const unsigned int nnode = na.Size();
		for(unsigned int inode=0;inode<nnode;inode++){
			ns_val.SetValue(inode,0,rand()*2.0/(1.0+RAND_MAX)-1.0);
		}
	}  
}
开发者ID:ryujimiya,项目名称:delfem4net,代码行数:48,代码来源:field_value_setter.cpp

示例3: MakeResidual

double CLinearSystem_Save::MakeResidual(const Fem::Field::CFieldWorld& world)
{
	const unsigned int nseg = this->m_aSegField.size();
	if( nseg == 0 )	return 0.0;

	////////////////////////////////
	// updateに値をセットする
	for(unsigned  int ilss=0;ilss<nseg;ilss++){
		const CLinSysSeg_Field& ls = this->m_aSegField[ilss];
		CVector_Blk* update = this->m_ls.m_Update[ilss];
		unsigned int ilen1 = 0;
		{
			const Fem::Field::CField& field = world.GetField(ls.id_field);
			ilen1 = field.GetNLenValue();
			unsigned int id_na_val = field.GetNodeSegInNodeAry(CORNER).id_na_va;
			unsigned int id_ns_val = field.GetNodeSegInNodeAry(CORNER).id_ns_va;
			assert( world.IsIdNA(id_na_val) );
			const CNodeAry& na = world.GetNA(id_na_val);
			na.GetValueFromNodeSegment(id_ns_val,*update);
		}
		if( world.IsIdField(ls.id_field2) ){
			const Fem::Field::CField& field = world.GetField(ls.id_field2);
			unsigned int id_na_val = field.GetNodeSegInNodeAry(CORNER).id_na_va;
			unsigned int id_ns_val = field.GetNodeSegInNodeAry(CORNER).id_ns_va;
			assert( world.IsIdNA(id_na_val) );
			const CNodeAry& na = world.GetNA(id_na_val);
			na.GetValueFromNodeSegment(id_ns_val,*update,ilen1);
		}
	}

	for(unsigned int iseg=0;iseg<nseg;iseg++){
		(*m_ls.m_Residual[iseg]) = (*m_Force[iseg]);
	}

	for(unsigned int iseg=0;iseg<nseg;iseg++){
	for(unsigned int jseg=0;jseg<nseg;jseg++){
		if( m_Matrix_Boundary[iseg][jseg] == 0 ) continue;
		m_Matrix_Boundary[iseg][jseg]->MatVec( -1.0, (*m_ls.m_Update[jseg]), 1.0, (*m_ls.m_Residual[iseg]), true );
	}
	}
	return sqrt(this->DOT(-1,-1));
}
开发者ID:ryujimiya,项目名称:delfem4net,代码行数:42,代码来源:linearsystem_fieldsave.cpp

示例4: SetTexScale

void CDrawerFace::SetTexScale(double scale, const Fem::Field::CFieldWorld& world){
  tex_scale = scale;  
  if( pUVArray != 0 ){
    if( !world.IsIdField(m_id_field) ) return;
    const Fem::Field::CField& field = world.GetField(m_id_field);
    // set the vertex array
    unsigned int id_na_c_co = field.GetNodeSegInNodeAry(CORNER).id_na_co;
    assert( world.IsIdNA(id_na_c_co) );
//    const Fem::Field::CNodeAry& na_c_co = world.GetNA(id_na_c_co);
    assert( field.IsNodeSeg(CORNER,false,world) );
    const Fem::Field::CNodeAry::CNodeSeg& ns_c_co = field.GetNodeSeg(CORNER,false,world);      
    for(unsigned int ino=0;ino<ns_c_co.Size();ino++){
      double c[3]; ns_c_co.GetValue(ino,c);
      pUVArray[ino*2+0] = c[0]*tex_scale;
      pUVArray[ino*2+1] = c[1]*tex_scale;
    }
  }   
}
开发者ID:CrazyHeex,项目名称:delfem,代码行数:18,代码来源:drawer_field_face.cpp

示例5: if

bool CDrawerFace::Set
(unsigned int id_field, const Fem::Field::CFieldWorld& world, bool isnt_value_disp,
 unsigned int id_field_val)
{
	if( !world.IsIdField(id_field) ){ return false; }
	////////////////
	this->m_id_field = id_field;
	this->id_field_val = id_field_val;
	this->m_isnt_value_disp = isnt_value_disp;

	const Fem::Field::CField& field = world.GetField(id_field);

	// setting of vertex array
	unsigned int id_na_c_co = field.GetNodeSegInNodeAry(CORNER).id_na_co;
	unsigned int id_na_c_val = field.GetNodeSegInNodeAry(CORNER).id_na_va;
	////////////////////////////////
	// decide whether draw ns of value or coord
	if( id_na_c_val == 0 ){ 
		this->m_is_draw_nsv = false;	// draw NS of Coord
		this->m_isnt_value_disp = true;	// don't include displacement
	}
	else{ this->m_is_draw_nsv = true;}
	////////////////
	assert( field.IsNodeSeg(CORNER,false,world,VALUE) );
	unsigned int ndim_field = field.GetNDimCoord();
	////////////////
	unsigned int npoin;
	if( m_is_draw_nsv ){
		assert( world.IsIdNA(id_na_c_val) );
		const Fem::Field::CNodeAry& na_c_val = world.GetNA(id_na_c_val);
		npoin = na_c_val.Size();
	}
	else{ 
		assert( id_na_c_co != 0 );
		const Fem::Field::CNodeAry& na_c_co = world.GetNA(id_na_c_co);
		npoin = na_c_co.Size(); 
	}
	////////////////
  // set size to vertex array
  
	unsigned int ndim_draw;
	if( this->m_isnt_value_disp == false 
     && ndim_field == 2 
     && (field.GetFieldType()==SCALAR||field.GetFieldType()==ZSCALAR) ){
		ndim_draw = 3;
	}
	else{ ndim_draw = ndim_field; }
  this->m_vertex_ary.SetSize(npoin,ndim_draw);
  
  { // normal
    const bool is_normal = ( pNormalArray != 0 );
    if( pNormalArray != 0 ){ delete pNormalArray; pNormalArray = 0; }
    if( is_normal ){ pNormalArray = new double [npoin*3]; }
  }
  { // uv map
    const bool is_uv = ( pUVArray != 0 );
    if( pUVArray != 0 ){ delete pUVArray; pUVArray = 0; }
    if( is_uv ){ pUVArray = new double [npoin*2]; }  
  }
    
	////////////////
	if(      ndim_draw  == 2 ){ sutable_rot_mode = 1; }
	else if( ndim_field == 3 ){ sutable_rot_mode = 3; }
	else                      { sutable_rot_mode = 2; }
	CDrawerFace::Update(world);

	////////////////////////////////
	{	// setting of element array        
		const std::vector<unsigned int>& aIdEA = field.GetAryIdEA();
		for(unsigned int iiea=0;iiea<aIdEA.size();iiea++){
			const unsigned int id_ea = aIdEA[iiea];
			assert( world.IsIdEA(id_ea) );
			unsigned int id_es_c;
			if( m_is_draw_nsv ){ id_es_c = field.GetIdElemSeg(id_ea,CORNER,true, world); }
			else{                id_es_c = field.GetIdElemSeg(id_ea,CORNER,false,world); }
			assert( id_es_c != 0 );
			CIndexArrayElem* pIAE = new CIndexArrayElem(id_ea,id_es_c,world);
			pIAE->ilayer = field.GetLayer(id_ea);
			this->m_apIndexArrayElem.push_back( pIAE );
		}
	}

	////////////////////////////////
	// color setting

	if( world.IsIdField(id_field_val) ){
		const Fem::Field::CField& field_val = world.GetField(id_field_val);
		unsigned int id_na_c_val = field_val.GetNodeSegInNodeAry(CORNER).id_na_va;
		unsigned int id_na_b_val = field_val.GetNodeSegInNodeAry(BUBBLE).id_na_va;
		if(      world.IsIdNA(id_na_c_val) ){
			if( pColorArray != 0 ){ delete[] pColorArray;  pColorArray=0; }
		}
		else if( world.IsIdNA(id_na_b_val) ){
		}
	}
	this->Update(world);
	return true;
}
开发者ID:CrazyHeex,项目名称:delfem,代码行数:98,代码来源:drawer_field_face.cpp

示例6: if

bool View::CIndexArrayElem::SetColor
(unsigned int id_es_v, unsigned int id_ns_v, const Fem::Field::CFieldWorld& world,
 const std::auto_ptr<CColorMap>& color_map )
{
	if( itype == Fem::Field::TRI )	// TRI
	{
		if( !world.IsIdEA(id_ea) ) return false;
		const CElemAry& ea = world.GetEA(id_ea);
		if( !ea.IsSegID(id_es) ) return false;
		if( ea.ElemType() != TRI ) return false;
		const CElemAry::CElemSeg& es_v = ea.GetSeg(id_es_v);
//		assert( es_v.Size() == 1 );
		unsigned int id_na_v = es_v.GetIdNA();
		assert( world.IsIdNA(id_na_v) );
		const CNodeAry& na = world.GetNA(id_na_v);
		assert( es_v.GetMaxNoes() < na.Size() );
		assert( na.IsSegID(id_ns_v) );
		const CNodeAry::CNodeSeg& ns = na.GetSeg(id_ns_v);
		assert( ns.Length() == 1 );
		if( this->pColor == 0 ){ this->pColor = new float [nElem*3]; }
		for(unsigned int itri=0;itri<nElem;itri++){
			unsigned int inode0;
			es_v.GetNodes(itri,&inode0);
			double val;
			ns.GetValue(inode0,&val);
			color_map->GetColor(pColor+itri*3,val);
		}
		return true;
	}
	else if( itype == Fem::Field::QUAD )
	{
		if( !world.IsIdEA(id_ea) ) return false;
		const CElemAry& ea = world.GetEA(id_ea);
		if( !ea.IsSegID(id_es) ) return false;
		if( ea.ElemType() != QUAD ) return false;
		const CElemAry::CElemSeg& es_v = ea.GetSeg(id_es_v);
		assert( es_v.Length() == 1 );
		unsigned int id_na_v = es_v.GetIdNA();
		assert( world.IsIdNA(id_na_v) );
		const CNodeAry& na = world.GetNA(id_na_v);
		assert( es_v.GetMaxNoes() < na.Size() );
		assert( na.IsSegID(id_ns_v) );
		const CNodeAry::CNodeSeg& ns = na.GetSeg(id_ns_v);
		assert( ns.Length() == 1 );
		if( this->pColor == 0 ){ this->pColor = new float [nElem*3]; }
		for(unsigned int iquad=0;iquad<nElem;iquad++){
			unsigned int inode0;
			es_v.GetNodes(iquad,&inode0);
			double val;
			ns.GetValue(inode0,&val);
			color_map->GetColor(pColor+iquad*3,val);
		}
		return true;
	}
	else if( itype == Fem::Field::TET )
	{
		if( !world.IsIdEA(id_ea) ) return false;
		const CElemAry& ea = world.GetEA(id_ea);
		const unsigned int ntet = ea.Size();
		if( !ea.IsSegID(id_es) ) return false;
		if( ea.ElemType() != TET ) return false;
		const CElemAry::CElemSeg& es_v = ea.GetSeg(id_es_v);
		assert( es_v.Length() == 1 );
		unsigned int id_na_v = es_v.GetIdNA();
		assert( world.IsIdNA(id_na_v) );
		const CNodeAry& na = world.GetNA(id_na_v);
		assert( es_v.GetMaxNoes() < na.Size() );
		assert( na.IsSegID(id_ns_v) );
		const CNodeAry::CNodeSeg& ns = na.GetSeg(id_ns_v);
		assert( ns.Length() == 1 );
		if( this->pColor == 0 ){ this->pColor = new float [nElem*3]; }
		for(unsigned int iface=0;iface<nElem;iface++){
			unsigned int itet = aIndElem[iface];
			assert( itet < ntet );
			unsigned int inode0;
			es_v.GetNodes(itet,&inode0);
			double val;
			ns.GetValue(inode0,&val);
			color_map->GetColor(pColor+iface*3,val);
		}
		return true;
	}
	else if( itype == Fem::Field::HEX )
	{	
		if( !world.IsIdEA(id_ea) ) return false;
		const CElemAry& ea = world.GetEA(id_ea);
		const unsigned int nhex = ea.Size();
		if( !ea.IsSegID(id_es) ) return false;
		if( ea.ElemType() != HEX ) return false;
		const CElemAry::CElemSeg& es_v = ea.GetSeg(id_es_v);
		assert( es_v.Length() == 1 );
		unsigned int id_na_v = es_v.GetIdNA();
		assert( world.IsIdNA(id_na_v) );
		const CNodeAry& na = world.GetNA(id_na_v);
		assert( es_v.GetMaxNoes() < na.Size() );
		assert( na.IsSegID(id_ns_v) );
		const CNodeAry::CNodeSeg& ns = na.GetSeg(id_ns_v);
		assert( ns.Length() == 1 );
		if( this->pColor == 0 ){ this->pColor = new float [nElem*3]; }
		for(unsigned int iface=0;iface<nElem;iface++){
//.........这里部分代码省略.........
开发者ID:gabriel-tandil,项目名称:SENSITIVE_COUTURE,代码行数:101,代码来源:drawer_field.cpp

示例7: if

//! set gradient value to the field
bool Fem::Field::SetFieldValue_Gradient
(unsigned int id_field_to, Fem::Field::CFieldWorld& world,
 unsigned int id_field_from)
{  
	if( !world.IsIdField(id_field_from) ) return false;
	Fem::Field::CField& field_from = world.GetField(id_field_from);
  
	if( !world.IsIdField(id_field_to) ) return false;
	Fem::Field::CField& field_to = world.GetField(id_field_to);  
  
	if( field_to.GetAryIdEA().size() != 1 ){
		std::cout << "Error!-->Not Implimented" << std::endl;
		getchar();
		assert(0);
	}
  
	Fem::Field::INTERPOLATION_TYPE type_from, type_to;
	{
		const std::vector<unsigned int>& aIdEA_from = field_from.GetAryIdEA();
		const std::vector<unsigned int>& aIdEA_to   = field_to.GetAryIdEA();
		if( aIdEA_from.size() != aIdEA_to.size() ) return false;
		const unsigned int niea = aIdEA_from.size();
		assert( niea == 1 );
		if( aIdEA_from[0] != aIdEA_to[0] ) return false;
		const unsigned int id_ea = aIdEA_from[0];
		type_from = field_from.GetInterpolationType(id_ea,world);
		type_to   = field_to.GetInterpolationType(id_ea,world);
	}
  
	unsigned int nnoes, ndim;
	if( type_from==HEX11 && type_to==HEX1001 ){
		nnoes = 8; ndim = 3;
	}
	else if( type_from==TET11 && type_to==TET1001 ){
		nnoes = 4; ndim = 3;
	}
	else if( type_from==TRI11 && type_to==TRI1001 ){
		nnoes = 3; ndim = 2;
	}
	else{
		std::cout << "NotImplimented!" << std::endl;
		assert(0);
		getchar();
	}
  
	unsigned int id_ea = field_to.GetAryIdEA()[0];
	const CElemAry& ea = world.GetEA(id_ea);
	const CElemAry::CElemSeg& es_c_co = field_from.GetElemSeg(id_ea,CORNER,false,world);
	const CElemAry::CElemSeg& es_c_va = field_from.GetElemSeg(id_ea,CORNER,true, world);
	const CElemAry::CElemSeg& es_b_va = field_to.GetElemSeg(id_ea,BUBBLE,true, world);
  
	const Fem::Field::CField::CNodeSegInNodeAry& nsna_c = field_from.GetNodeSegInNodeAry(CORNER);
	assert( world.IsIdNA(nsna_c.id_na_co) );
	assert( world.IsIdNA(nsna_c.id_na_va) );
	const CNodeAry& na_c_co = world.GetNA(nsna_c.id_na_co);
	const CNodeAry::CNodeSeg& ns_c_co = na_c_co.GetSeg(nsna_c.id_ns_co);
	const CNodeAry& na_c_va = world.GetNA(nsna_c.id_na_va);
	const CNodeAry::CNodeSeg& ns_c_va = na_c_va.GetSeg(nsna_c.id_ns_va);
	unsigned int id_na_b_va = field_to.GetNodeSegInNodeAry(BUBBLE).id_na_va;
	unsigned int id_ns_b_va = field_to.GetNodeSegInNodeAry(BUBBLE).id_ns_va;
  
	assert( world.IsIdNA(id_na_b_va) );
	CNodeAry& na_b_va = world.GetNA(id_na_b_va);
	CNodeAry::CNodeSeg& ns_b_va = na_b_va.GetSeg(id_ns_b_va);
  
	double coord[16][3];
	double value[16];
	double grad[3];
  
  //	const unsigned int nnoes_c = es_c_co.GetSizeNoes();
	unsigned int noes[64];
  
	for(unsigned int ielem=0;ielem<ea.Size();ielem++){
		{	// 座標(coord)と値(value)を作る
			es_c_co.GetNodes(ielem,noes);
			for(unsigned int inoes=0;inoes<nnoes;inoes++){
				unsigned int ipoi0 = noes[inoes];
				assert( ipoi0 < na_c_co.Size() );
				ns_c_co.GetValue(ipoi0,coord[inoes]);
			}
      /*			if( id_es_c_va == id_es_c_co ){	
       for(unsigned int inoes=0;inoes<nnoes;inoes++){
       unsigned int ipoi0 = noes[inoes];
       assert( ipoi0 < na_c_va.Size() );
       na_c_va.GetValueFromNode(ipoi0,id_ns_c_va,0,val);
       value[inoes] = val;
       }
       }
       else{*/
      es_c_va.GetNodes(ielem,noes);
      for(unsigned int inoes=0;inoes<nnoes;inoes++){
        unsigned int ipoi0 = noes[inoes];
        assert( ipoi0 < na_c_va.Size() );
        ns_c_va.GetValue(ipoi0,&value[inoes]);
      }
      //			}
		}
		if( type_from == HEX11 ){
			double dndx[8][3];
//.........这里部分代码省略.........
开发者ID:ryujimiya,项目名称:delfem4net,代码行数:101,代码来源:field_value_setter.cpp

示例8: assert

// ÉXÉJÉâÅ[ÇÃâûóÕëäìñílÇí«â¡Ç∑ÇÈÅDǪÇÃǧÇøÉÇÅ[ÉhÇǬÇØÇÈ
// mode = 0 : É~Å[É[ÉX
// mode = 1 : ç≈ëÂâûóÕ
// äÙâΩäwìIÇ»îÒê¸å`ê´Ççló∂Ç∑ÇÈǩǫǧǩÇÕÅCEqnObjÇå©ÇƒåàÇflÇÈÇÊǧDžÇ∑ÇÈ
bool CEqnSystem_Solid2D::SetEquivStressValue(unsigned int id_field_str, Fem::Field::CFieldWorld& world)
{	
	if( !world.IsIdField(id_field_str) ) return false;
	Fem::Field::CField& field_str = world.GetField(id_field_str);
	if( field_str.GetFieldType() != SCALAR ) return false;

	if( !world.IsIdField(m_IdFieldDisp) ) return false;
	Fem::Field::CField& field_dis = world.GetField(m_IdFieldDisp);

	const std::vector<unsigned int>& aIdEA_from = field_dis.GetAryIdEA();
	const std::vector<unsigned int>& aIdEA_to   = field_str.GetAryIdEA();
	if( aIdEA_from.size() != aIdEA_to.size() ) return false;

	const unsigned int niea = aIdEA_from.size();
	for(unsigned int iiea=0;iiea<niea;iiea++)
	{
		Fem::Field::INTERPOLATION_TYPE type_from, type_to;
		{
			if( aIdEA_from[iiea] != aIdEA_to[iiea] ){
				assert(0);
				return false;
			}
			const unsigned int id_ea = aIdEA_from[iiea];
			type_from = field_dis.GetInterpolationType(id_ea,world);
			type_to   = field_str.GetInterpolationType(id_ea,world);
		}

		unsigned int nnoes, ndim;
		if( type_from==TRI11 && type_to==TRI1001 ){
			nnoes = 3; ndim = 2;
		}
		else{
			std::cout << "Error!-->Not Implimented!" << std::endl;
			std::cout << type_from << " " << type_to << std::endl;
			assert(0);
			getchar();
		}

		unsigned int id_ea = aIdEA_to[iiea];
		const CElemAry& ea = world.GetEA(id_ea);
		const CElemAry::CElemSeg& es_c_co = field_dis.GetElemSeg(id_ea,CORNER,false,world);
		const CElemAry::CElemSeg& es_c_va = field_dis.GetElemSeg(id_ea,CORNER,true, world);
		const CElemAry::CElemSeg& es_b_va = field_str.GetElemSeg(id_ea,BUBBLE,true, world);

		Fem::Field::CField::CNodeSegInNodeAry nans_c = field_dis.GetNodeSegInNodeAry(CORNER);
		assert( world.IsIdNA(nans_c.id_na_co) );
		assert( world.IsIdNA(nans_c.id_na_va) );
		const CNodeAry& na_c_co = world.GetNA( nans_c.id_na_co);
		const CNodeAry::CNodeSeg& ns_c_co = na_c_co.GetSeg( nans_c.id_ns_co);
		const CNodeAry& na_c_va = world.GetNA( nans_c.id_na_va);
		const CNodeAry::CNodeSeg& ns_c_va = na_c_va.GetSeg( nans_c.id_ns_va);

		Fem::Field::CField::CNodeSegInNodeAry nans_b = field_str.GetNodeSegInNodeAry(BUBBLE);
		unsigned int id_na_b_va = nans_b.id_na_va;
		unsigned int id_ns_b_va = nans_b.id_ns_va;

		assert( world.IsIdNA(id_na_b_va) );
		CNodeAry& na_b_va = world.GetNA(id_na_b_va);
		CNodeAry::CNodeSeg& ns_b_va = na_b_va.GetSeg(id_ns_b_va);

    const unsigned int nnoes_c = es_c_co.Length();
    assert( nnoes_c < 64 );
		unsigned int noes[64];
    const CEqn_Solid2D& eqn = this->GetEquation(id_ea);
		for(unsigned int ielem=0;ielem<ea.Size();ielem++){
			////////////////
			double coord[16][3];
			// ç¿ïW(coord)Ç∆íl(value)ÇçÏÇÈ
			es_c_co.GetNodes(ielem,noes);
			for(unsigned int inoes=0;inoes<nnoes;inoes++){
				unsigned int ipoi0 = noes[inoes];
				assert( ipoi0 < na_c_co.Size() );
				ns_c_co.GetValue(ipoi0,coord[inoes]);
			}
			////////////////
			double disp[16][3];	// êflì_ïœà 
			es_c_va.GetNodes(ielem,noes);
			for(unsigned int inoes=0;inoes<nnoes;inoes++){
				unsigned int ipoi0 = noes[inoes];
				assert( ipoi0 < na_c_va.Size() );
				for(unsigned int idim=0;idim<ndim;idim++){
					ns_c_va.GetValue(ipoi0,disp[inoes]);
				}
			}
			////////////////
			double dudx[2][2];	// ïœå`å˘îz
			if( type_from == TRI11 ){
				double dldx[3][2];
				double const_term[3];
				TriDlDx(dldx,const_term, coord[0],coord[1],coord[2]);
				for(unsigned int i=0;i<ndim*ndim;i++){ (&dudx[0][0])[i] = 0.0; }
				for(unsigned int knoes=0;knoes<nnoes;knoes++){
					dudx[0][0] += disp[knoes][0]*dldx[knoes][0];
					dudx[0][1] += disp[knoes][0]*dldx[knoes][1];
					dudx[1][0] += disp[knoes][1]*dldx[knoes][0];
					dudx[1][1] += disp[knoes][1]*dldx[knoes][1];
//.........这里部分代码省略.........
开发者ID:ryujimiya,项目名称:delfem4net,代码行数:101,代码来源:eqnsys_solid.cpp


注:本文中的fem::field::CFieldWorld::IsIdNA方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。