本文整理汇总了C++中DofManager::hasDofID方法的典型用法代码示例。如果您正苦于以下问题:C++ DofManager::hasDofID方法的具体用法?C++ DofManager::hasDofID怎么用?C++ DofManager::hasDofID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DofManager
的用法示例。
在下文中一共展示了DofManager::hasDofID方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeEnrichedDofManDofIdArray
void
EnrichmentItem :: computeEnrichedDofManDofIdArray(IntArray &oDofIdArray, DofManager &iDMan)
{
// Gives an array containing the dofId's that
// are candidates for enrichment. At the moment,
// regular dofs are considered as candidates. In
// the future, we may also consider enriching
// enriched dofs from other enrichment items.
const IntArray *enrichesDofsWithIdArray = this->giveEnrichesDofsWithIdArray();
// Number of candidates for enrichment
int numEnrCand = enrichesDofsWithIdArray->giveSize();
// Number of active enrichment functions
int numEnrFunc = this->giveNumDofManEnrichments(iDMan);
// Go through the list of dofs that the EI supports
// and compare with the available dofs in the dofMan.
int count = 0;
for ( int i = 1; i <= numEnrFunc; i++ ) {
for ( int j = 1; j <= numEnrCand; j++ ) {
if ( iDMan.hasDofID( ( DofIDItem ) enrichesDofsWithIdArray->at(j) ) ) {
count++;
}
}
}
oDofIdArray.resize(count);
for ( int i = 1; i <= count; i++ ) {
oDofIdArray.at(i) = this->giveStartOfDofIdPool() + i - 1;
}
}
示例2: giveEnrichedDofIDs
IntArray XfemManager :: giveEnrichedDofIDs(const DofManager &iDMan) const
{
IntArray dofIdArray;
for(int id : mXFEMPotentialDofIDs) {
if(iDMan.hasDofID( DofIDItem(id) )) {
dofIdArray.followedBy(id);
}
}
return dofIdArray;
}
示例3: computeLocationArrayOfDofIDs
void
StructuralInterfaceElementPhF :: computeLocationArrayOfDofIDs( const IntArray &dofIdArray, IntArray &answer )
{
// Routine to compute the local ordering array an element given a dofid array.
answer.resize( 0 );
int k = 0;
for(int i = 1; i <= this->giveNumberOfDofManagers(); i++) {
DofManager *dMan = this->giveDofManager( i );
for(int j = 1; j <= dofIdArray.giveSize( ); j++) {
if(dMan->hasDofID( (DofIDItem) dofIdArray.at( j ) )) {
// hack
answer.followedBy( k + j );
}
}
k += dMan->giveNumberOfDofs( );
}
}
示例4: computeLocationArrayOfDofIDs
void
PhaseFieldElement :: computeLocationArrayOfDofIDs( const IntArray &dofIdArray, IntArray &answer )
{
// Routine to extract compute the location array an element given an dofid array.
answer.clear();
NLStructuralElement *el = this->giveElement();
int k = 0;
for ( int i = 1; i <= el->giveNumberOfDofManagers(); i++ ) {
DofManager *dMan = el->giveDofManager( i );
for ( int j = 1; j <= dofIdArray.giveSize( ); j++ ) {
if ( dMan->hasDofID( (DofIDItem) dofIdArray.at( j ) ) ) {
Dof *d = dMan->giveDofWithID( dofIdArray.at( j ) );
answer.followedBy( k + d->giveNumber( ) );
}
}
k += dMan->giveNumberOfDofs( );
}
}
示例5: computeLocationArrayOfDofIDs
void
CoupledFieldsElement :: computeLocationArrayOfDofIDs(const IntArray &dofIdArray, IntArray &answer)
{
// Routine to extract compute the location array an element given an dofid array.
answer.resize(0);
int k = 0;
for ( int i = 1; i <= numberOfDofMans; i++ ) {
DofManager *dMan = this->giveDofManager(i);
for (int j = 1; j <= dofIdArray.giveSize(); j++ ) {
if ( dMan->hasDofID( (DofIDItem) dofIdArray.at(j) ) ) {
Dof *d = dMan->giveDofWithID( dofIdArray.at(j) );
answer.followedBy( k + d->giveNumber() );
//answer.followedBy( k + j );
}
}
k += dMan->giveNumberOfDofs( );
}
}
示例6: computeVectorOfDofIDs
void
CoupledFieldsElement :: computeVectorOfDofIDs(const IntArray &dofIdArray, ValueModeType valueMode, TimeStep *stepN, FloatArray &answer)
{
// Routine to extract the solution vector for an element given an dofid array.
// Size will be numberOfDofs and if a certain dofId does not exist a zero is used as value.
answer.resize( numberOfDofMans * dofIdArray.giveSize() ); // equal number of nodes for all fields
answer.zero();
int k = 1;
for ( int i = 1; i <= numberOfDofMans; i++ ) {
DofManager *dMan = this->giveDofManager(i);
for (int j = 1; j <= dofIdArray.giveSize(); j++ ) {
if ( dMan->hasDofID( (DofIDItem) dofIdArray.at(j) ) ) {
Dof *d = dMan->giveDofWithID( dofIdArray.at(j) );
answer.at(k) = d->giveUnknown(valueMode, stepN);
}
k++;
}
}
}
示例7: 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 ) );
}
}
}
}
}
}
示例8: 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 ]);
}
}
}