static void BoundaryCondition (unsigned int id_field, const ELSEG_TYPE& elseg_type, MatVec::CBCFlag& bc_flag, const CFieldWorld& world, unsigned int ioffset=0) { if( !world.IsIdField(id_field) ) return; const Fem::Field::CField& field = world.GetField(id_field); { // Assert const unsigned int len = bc_flag.LenBlk(); assert( ioffset < len ); } const unsigned int nlen = field.GetNLenValue(); const std::vector<unsigned int>& aIdEA = field.GetAryIdEA(); for(unsigned int iea=0;iea<aIdEA.size();iea++){ unsigned int id_ea = aIdEA[iea]; const CElemAry& ea = world.GetEA(id_ea); unsigned int noes[256]; if( elseg_type == CORNER && field.GetIdElemSeg(id_ea,CORNER,true,world) != 0 ){ const Fem::Field::CElemAry::CElemSeg& es = field.GetElemSeg(id_ea,CORNER,true,world); unsigned int nnoes = es.Length(); for(unsigned int ielem=0;ielem<ea.Size();ielem++){ es.GetNodes(ielem,noes); for(unsigned int inoes=0;inoes<nnoes;inoes++){ for(unsigned int ilen=0;ilen<nlen;ilen++){ bc_flag.SetBC(noes[inoes],ilen+ioffset); } } } } if( elseg_type == BUBBLE && field.GetIdElemSeg(id_ea,BUBBLE,true,world) != 0 ){ const Fem::Field::CElemAry::CElemSeg& es = field.GetElemSeg(id_ea,BUBBLE,true,world); unsigned int nnoes = es.Length(); for(unsigned int ielem=0;ielem<ea.Size();ielem++){ es.GetNodes(ielem,noes); for(unsigned int inoes=0;inoes<nnoes;inoes++){ for(unsigned int ilen=0;ilen<nlen;ilen++){ bc_flag.SetBC(noes[inoes],ilen+ioffset); } } } } if( elseg_type == EDGE && field.GetIdElemSeg(id_ea,EDGE,true,world) != 0 ){ const Fem::Field::CElemAry::CElemSeg& es = field.GetElemSeg(id_ea,EDGE,true,world); unsigned int nnoes = es.Length(); for(unsigned int ielem=0;ielem<ea.Size();ielem++){ es.GetNodes(ielem,noes); for(unsigned int inoes=0;inoes<nnoes;inoes++){ for(unsigned int ilen=0;ilen<nlen;ilen++){ bc_flag.SetBC(noes[inoes],ilen+ioffset); } } } } } }
//---------------------------------------------------------------------- // CBCFlag //---------------------------------------------------------------------- MatVec::CBCFlag * CBCFlag::CreateNativeInstance(const MatVec::CBCFlag& rhs) { MatVec::CBCFlag * ptr = NULL; int len = rhs.LenBlk(); unsigned int nblk = rhs.NBlk(); if (len != -1) { ptr = new MatVec::CBCFlag(nblk, len); } else { std::vector<unsigned int> alen; for (unsigned int iblk = 0; iblk < nblk; iblk++) { unsigned int nlen_blk = rhs.LenBlk(iblk); alen.push_back(nlen_blk); } ptr = new MatVec::CBCFlag(nblk, alen); } ptr->SetAllFlagZero(); // フラグをすべてOFFにする // ONの箇所だけ設定 for (unsigned int iblk = 0; iblk < nblk; iblk++) { unsigned int nlen_blk = rhs.LenBlk(iblk); for (unsigned int idofblk = 0; idofblk < nlen_blk; idofblk++) { int bc_flag = rhs.GetBCFlag(iblk, idofblk); if (bc_flag != 0) { // len != -1の場合の処理しかない? assert(nlen_blk == len); ptr->SetBC(iblk, idofblk); // ONにする } } } return ptr; }
// elem_aryに含まれる節点全てidofblk番目の自由度を固定する static bool SetBCFlagToES (unsigned int id_field, MatVec::CBCFlag& bc_flag, const Fem::Field::CElemAry& ea, unsigned int id_es, unsigned int idofblk) { assert( (int)idofblk < bc_flag.LenBlk() ); if( (int)idofblk >= bc_flag.LenBlk() ) return false; assert( ea.IsSegID(id_es) ); const Fem::Field::CElemAry::CElemSeg& es = ea.GetSeg(id_es); unsigned int noes[256]; unsigned int nnoes = es.Length(); for(unsigned int ielem=0;ielem<ea.Size();ielem++){ es.GetNodes(ielem,noes); for(unsigned int inoes=0;inoes<nnoes;inoes++){ const unsigned int inode0 = noes[inoes]; bc_flag.SetBC(inode0,idofblk); // m_Flag[inode0*m_lenBlk+idofblk] = 1; } } return true; }