本文整理汇总了C++中DofManager::appendDof方法的典型用法代码示例。如果您正苦于以下问题:C++ DofManager::appendDof方法的具体用法?C++ DofManager::appendDof怎么用?C++ DofManager::appendDof使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DofManager
的用法示例。
在下文中一共展示了DofManager::appendDof方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dofIdArray
void
ContactDefinition :: createContactDofs()
{
// Creates new dofs due associated with the contact (Lagrange multipliers) and appends them to the dof managers
// Creates new dofs due associated with the contact (Lagrange multipliers) and appends them to the dof managers
//TODO This is a bit ugly, find a better solution than asking the contact el
if ( int numDofs = this->giveNumberOfConstraintEqToAdd() ) {
// get an array with dof ids' to append to
IntArray dofIdArray(numDofs), dofMans;
for ( int i = 1; i <= numDofs; i++ ) {
dofIdArray.at(i) = this->cMan->giveDomain()->giveNextFreeDofID();
}
for ( ContactElement *cEl : this->masterElementList ) {
cEl->giveDofManagersToAppendTo(dofMans);
if ( dofMans.giveSize() ) { // if the contact element adds extra dofs, store them. Maybe just store in cDef?
cEl->setDofIdArray(dofIdArray);
}
for ( int i = 1; i <= dofMans.giveSize(); i++ ) {
DofManager *dMan = this->cMan->giveDomain()->giveDofManager(dofMans.at(i));
for ( auto &dofid: dofIdArray ) {
if ( !dMan->hasDofID( ( DofIDItem ) ( dofid ) ) ) {
dMan->appendDof( new MasterDof( dMan, ( DofIDItem ) dofid ) );
}
}
}
}
}
}
示例2: iDof
void EnrichmentItem :: createEnrichedDofs()
{
// Creates new dofs due to the enrichment and appends them to the dof managers
int nrDofMan = this->giveDomain()->giveNumberOfDofManagers();
IntArray EnrDofIdArray;
mEIDofIdArray.clear();
//int bcIndex = -1;
int icIndex = -1;
// Create new dofs
for ( int i = 1; i <= nrDofMan; i++ ) {
DofManager *dMan = this->giveDomain()->giveDofManager(i);
if ( isDofManEnriched(* dMan) ) {
//printf("dofMan %i is enriched \n", dMan->giveNumber());
computeEnrichedDofManDofIdArray(EnrDofIdArray, * dMan);
// Collect boundary condition ID of existing dofs
IntArray bcIndexArray;
for ( Dof *dof: *dMan ) {
bcIndexArray.followedBy(dof->giveBcId());
}
bool foundBC = false;
IntArray nonZeroBC;
if ( !bcIndexArray.containsOnlyZeroes() ) {
// BC is found on dofs
foundBC = true;
nonZeroBC.findNonzeros(bcIndexArray);
}
int iDof(1);
for ( auto &dofid: EnrDofIdArray ) {
if ( !dMan->hasDofID( ( DofIDItem ) ( dofid ) ) ) {
if ( mInheritBoundaryConditions || mInheritOrderedBoundaryConditions ) {
if ( foundBC ) {
// Append dof with BC
if ( mInheritOrderedBoundaryConditions ) {
///TODO: add choise of inheriting only specific BC.
// Assume order type of new dofs are the same as original
dMan->appendDof( new MasterDof(dMan, bcIndexArray.at(iDof), icIndex, ( DofIDItem ) dofid) );
} else {
// Append enriched dofs with same BC
dMan->appendDof( new MasterDof(dMan, bcIndexArray.at(nonZeroBC.at(1)), icIndex, ( DofIDItem ) dofid) );
}
} else {
// No BC found, append enriched dof without BC
dMan->appendDof( new MasterDof(dMan, ( DofIDItem ) dofid) );
}
} else {
// Append enriched dof without BC
dMan->appendDof( new MasterDof(dMan, ( DofIDItem ) dofid) );
}
}
iDof++;
}
}
}
// Remove old dofs
int poolStart = giveStartOfDofIdPool();
int poolEnd = giveEndOfDofIdPool();
for ( int i = 1; i <= nrDofMan; i++ ) {
DofManager *dMan = this->giveDomain()->giveDofManager(i);
computeEnrichedDofManDofIdArray(EnrDofIdArray, * dMan);
std :: vector< DofIDItem >dofsToRemove;
for ( Dof *dof: *dMan ) {
DofIDItem dofID = dof->giveDofID();
if ( dofID >= DofIDItem(poolStart) && dofID <= DofIDItem(poolEnd) ) {
bool dofIsInIdArray = false;
for ( int k = 1; k <= EnrDofIdArray.giveSize(); k++ ) {
if ( dofID == DofIDItem( EnrDofIdArray.at(k) ) ) {
dofIsInIdArray = true;
break;
}
}
if ( !dofIsInIdArray ) {
dofsToRemove.push_back(dofID);
}
if(mEIDofIdArray.findFirstIndexOf(dofID) == 0 && dofIsInIdArray) {
mEIDofIdArray.followedBy(dofID);
}
}
}
for ( size_t j = 0; j < dofsToRemove.size(); j++ ) {
dMan->removeDof(dofsToRemove [ j ]);
}
}
}