本文整理汇总了C++中Domain::giveDofManager方法的典型用法代码示例。如果您正苦于以下问题:C++ Domain::giveDofManager方法的具体用法?C++ Domain::giveDofManager怎么用?C++ Domain::giveDofManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Domain
的用法示例。
在下文中一共展示了Domain::giveDofManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: terminateLinStatic
void
LinearStability :: terminateLinStatic(TimeStep *stepN)
{
Domain *domain = this->giveDomain(1);
FILE *File;
int j;
File = this->giveOutputStream();
stepN->setTime(0.);
fprintf(File, "\nOutput for time % .3e \n\n", stepN->giveTargetTime() );
fprintf(File, "Linear static:\n\n");
int nnodes = domain->giveNumberOfDofManagers();
if ( requiresUnknownsDictionaryUpdate() ) {
for ( j = 1; j <= nnodes; j++ ) {
this->updateDofUnknownsDictionary(domain->giveDofManager(j), stepN);
}
}
for ( j = 1; j <= nnodes; j++ ) {
domain->giveDofManager(j)->updateYourself(stepN);
domain->giveDofManager(j)->printOutputAt(File, stepN);
}
# ifdef VERBOSE
VERBOSE_PRINT0("Updated nodes & sides ", nnodes)
# endif
Element *elem;
int nelem = domain->giveNumberOfElements();
for ( j = 1; j <= nelem; j++ ) {
elem = domain->giveElement(j);
elem->updateInternalState(stepN);
elem->updateYourself(stepN);
elem->printOutputAt(File, stepN);
}
# ifdef VERBOSE
VERBOSE_PRINT0("Updated Elements ", nelem)
# endif
fprintf(File, "\n");
/*
* // save context if required
* // default - save only if ALWAYS is set ( see cltypes.h )
*
* if ((domain->giveContextOutputMode() == COM_Always ) ||
* (domain->giveContextOutputMode() == COM_Required )) {
* this->saveContext(NULL);
* }
* else if (domain->giveContextOutputMode() == COM_UserDefined ) {
* if (stepN->giveNumber()%domain->giveContextOutputStep() == 0)
* this->saveContext(NULL);
* }
*/
this->printReactionForces(stepN, 1);
}
示例2: printReactionForces
void
StructuralEngngModel :: printReactionForces(TimeStep *tStep, int di)
//
// computes and prints reaction forces in all supported or restrained dofs
//
{
//
// Sum all equivalent forces for all connected elements
//
int i, numRestrDofs = 0;
IntArray ielemDofMask;
FloatArray reactions;
IntArray dofManMap, dofMap, eqnMap;
Domain *domain = this->giveDomain(di);
// test if solution step output is active
if ( !domain->giveOutputManager()->testTimeStepOutput(tStep) ) {
return;
}
FILE *outputStream = this->giveOutputStream();
// map contains corresponding dofmanager and dofs numbers corresponding to prescribed equations
// sorted according to dofmanger number and as a minor crit. according to dof number
// this is necessary for extractor, since the sorted output is expected
this->buildReactionTable(dofManMap, dofMap, eqnMap, tStep, di);
//
// print header
//
fprintf(outputStream, "\n\n\tR E A C T I O N S O U T P U T:\n\t_______________________________\n\n\n");
numRestrDofs = this->giveNumberOfPrescribedDomainEquations(di, EID_MomentumBalance);
reactions.resize(numRestrDofs);
// compute reaction forces
this->computeReaction(reactions, tStep, di);
//
// loop over reactions and print them
//
for ( i = 1; i <= numRestrDofs; i++ ) {
if ( domain->giveOutputManager()->testDofManOutput(dofManMap.at(i), tStep) ) {
//fprintf(outputStream,"\tNode %8d iDof %2d reaction % .4e\n",dofManMap.at(i), dofMap.at(i),reactions.at(eqnMap.at(i)));
#if defined ( __PARALLEL_MODE ) || defined ( __ENABLE_COMPONENT_LABELS )
fprintf( outputStream, "\tNode %8d iDof %2d reaction % .4e [bc-id: %d]\n",
domain->giveDofManager( dofManMap.at(i) )->giveLabel(),
dofMap.at(i), reactions.at( eqnMap.at(i) ),
domain->giveDofManager( dofManMap.at(i) )->giveDof( dofMap.at(i) )->giveBcId() );
#else
fprintf( outputStream, "\tNode %8d iDof %2d reaction % .4e [bc-id: %d]\n",
dofManMap.at(i), dofMap.at(i), reactions.at( eqnMap.at(i) ),
domain->giveDofManager( dofManMap.at(i) )->giveDof( dofMap.at(i) )->giveBcId() );
#endif
}
}
}
示例3: terminate
void EigenValueDynamic :: terminate(TimeStep *tStep)
{
Domain *domain = this->giveDomain(1);
FILE *outputStream = this->giveOutputStream();
int i, j;
// print loadcase header
fprintf(outputStream, "\nOutput for time % .3e \n\n", 1.0);
// print eigen values on output
fprintf(outputStream, "\n\nEigen Values (Omega^2) are:\n-----------------\n");
for ( i = 1; i <= numberOfRequiredEigenValues; i++ ) {
fprintf( outputStream, "%15.8e ", eigVal.at(i) );
if ( ( i % 5 ) == 0 ) {
fprintf(outputStream, "\n");
}
}
fprintf(outputStream, "\n\n");
int nnodes = domain->giveNumberOfDofManagers();
for ( i = 1; i <= numberOfRequiredEigenValues; i++ ) {
fprintf(outputStream, "\nOutput for eigen value no. % .3e \n", ( double ) i);
fprintf( outputStream,
"Printing eigen vector no. %d, corresponding eigen value is %15.8e\n\n",
i, eigVal.at(i) );
tStep->setTime( ( double ) i ); // we use time as intrinsic eigen value index
if ( this->requiresUnknownsDictionaryUpdate() ) {
for ( j = 1; j <= nnodes; j++ ) {
this->updateDofUnknownsDictionary(domain->giveDofManager(j), tStep);
}
}
for ( j = 1; j <= nnodes; j++ ) {
domain->giveDofManager(j)->updateYourself(tStep);
domain->giveDofManager(j)->printOutputAt(outputStream, tStep);
}
}
# ifdef VERBOSE
VERBOSE_PRINT0("Updated nodes & sides ", nnodes)
# endif
for ( i = 1; i <= numberOfRequiredEigenValues; i++ ) {
// export using export manager
tStep->setTime( ( double ) i ); // we use time as intrinsic eigen value index
tStep->setNumber(i);
exportModuleManager->doOutput(tStep);
}
fflush( this->giveOutputStream() );
this->saveStepContext(tStep);
}
示例4: terminate
void LinearStability :: terminate(TimeStep *stepN)
{
Domain *domain = this->giveDomain(1);
FILE *outputStream = this->giveOutputStream();
//FloatArray *eigv;
// Element *elem;
int i, j;
// print eigen values on output
fprintf(outputStream, "\nLinear Stability:");
fprintf(outputStream, "\nEigen Values are:\n-----------------\n");
for ( i = 1; i <= numberOfRequiredEigenValues; i++ ) {
fprintf( outputStream, "%15.8e ", eigVal.at(i) );
if ( ( i % 5 ) == 0 ) {
fprintf(outputStream, "\n");
}
}
fprintf(outputStream, "\n\n");
int nnodes = domain->giveNumberOfDofManagers();
for ( i = 1; i <= numberOfRequiredEigenValues; i++ ) {
fprintf(outputStream, "\nOutput for eigen value no. % .3e \n", ( double ) i);
fprintf( outputStream,
"Printing eigen vector no. %d, corresponding eigen value is %15.8e\n\n",
i, eigVal.at(i) );
stepN->setTime( ( double ) i );
if ( this->requiresUnknownsDictionaryUpdate() ) {
for ( j = 1; j <= nnodes; j++ ) {
this->updateDofUnknownsDictionary(domain->giveDofManager(j), stepN);
}
}
for ( j = 1; j <= nnodes; j++ ) {
domain->giveDofManager(j)->updateYourself(stepN);
domain->giveDofManager(j)->printOutputAt(outputStream, stepN);
}
stepN->setNumber( i );
exportModuleManager->doOutput(stepN);
}
# ifdef VERBOSE
VERBOSE_PRINT0("Updated nodes & sides ", nnodes)
# endif
fflush(this->giveOutputStream());
// save context if required
this->saveStepContext(stepN);
}
示例5: update
// project solutionVector to DoF unknowns dictionary
void
DofDistributedPrimaryField :: update(ValueModeType mode, TimeStep *tStep, FloatArray &vectorToStore)
{
Domain *domain = emodel->giveDomain(domainIndx);
int nnodes = domain->giveNumberOfDofManagers();
for ( int j = 1; j <= nnodes; j++ ) {
DofManager *inode = domain->giveDofManager(j);
for ( Dof *iDof: *inode ) {
int eqNum = iDof->__giveEquationNumber();
double val;
if ( mode == VM_Total ) {
if ( iDof->hasBc(tStep) ) { // boundary condition
val = iDof->giveBcValue(VM_Total, tStep);
} else {
//vect = this->UnknownsField->giveSolutionVector(tStep);
val = vectorToStore.at(eqNum);
}
} else { //all other modes, e.g. VM_RhsTotal
if ( !eqNum ) {
val = 0.; //assume that 0's are present in the beginning of node initiation
} else {
val = vectorToStore.at(eqNum);
}
}
iDof->updateUnknownsDictionary(tStep, mode, val);
}
}
}
示例6: estimateMaxPackSize
int
NonLinearDynamic :: estimateMaxPackSize(IntArray &commMap, DataStream &buff, int packUnpackType)
{
int count = 0, pcount = 0;
Domain *domain = this->giveDomain(1);
if ( packUnpackType == 0 ) { ///@todo Fix this old ProblemCommMode__NODE_CUT value
for ( int map: commMap ) {
DofManager *dman = domain->giveDofManager( map );
for ( Dof *dof: *dman ) {
if ( dof->isPrimaryDof() && ( dof->__giveEquationNumber() ) ) {
count++;
} else {
pcount++;
}
}
}
return ( buff.givePackSizeOfDouble(1) * max(count, pcount) );
} else if ( packUnpackType == 1 ) {
for ( int map: commMap ) {
count += domain->giveElement( map )->estimatePackSize(buff);
}
return count;
}
return 0;
}
示例7: packDofManagers
int
StructuralEngngModel :: packDofManagers(FloatArray *src, ProcessCommunicator &processComm, bool prescribedEquations)
{
int result = 1;
int i, size;
int j, ndofs, eqNum;
Domain *domain = this->giveDomain(1);
IntArray const *toSendMap = processComm.giveToSendMap();
ProcessCommunicatorBuff *pcbuff = processComm.giveProcessCommunicatorBuff();
DofManager *dman;
Dof *jdof;
size = toSendMap->giveSize();
for ( i = 1; i <= size; i++ ) {
dman = domain->giveDofManager( toSendMap->at(i) );
ndofs = dman->giveNumberOfDofs();
for ( j = 1; j <= ndofs; j++ ) {
jdof = dman->giveDof(j);
if ( prescribedEquations ) {
eqNum = jdof->__givePrescribedEquationNumber();
} else {
eqNum = jdof->__giveEquationNumber();
}
if ( jdof->isPrimaryDof() && eqNum ) {
result &= pcbuff->packDouble( src->at(eqNum) );
}
}
}
return result;
}
示例8: updateInternalState
void
StructuralEngngModel :: updateInternalState(TimeStep *stepN)
{
int j, nnodes;
Domain *domain;
for ( int idomain = 1; idomain <= this->giveNumberOfDomains(); idomain++ ) {
domain = this->giveDomain(idomain);
nnodes = domain->giveNumberOfDofManagers();
if ( requiresUnknownsDictionaryUpdate() ) {
for ( j = 1; j <= nnodes; j++ ) {
this->updateDofUnknownsDictionary(domain->giveDofManager(j), stepN);
}
}
if ( internalVarUpdateStamp != stepN->giveSolutionStateCounter() ) {
int nelem = domain->giveNumberOfElements();
for ( j = 1; j <= nelem; j++ ) {
domain->giveElement(j)->updateInternalState(stepN);
}
internalVarUpdateStamp = stepN->giveSolutionStateCounter();
}
}
}
示例9: estimateMaxPackSize
int
FreeWarping :: estimateMaxPackSize(IntArray &commMap, DataStream &buff, int packUnpackType)
{
int count = 0, pcount = 0;
Domain *domain = this->giveDomain(1);
if ( packUnpackType == 0 ) { ///@todo Fix this old ProblemCommMode__NODE_CUT value
for ( int map: commMap ) {
for ( Dof *jdof: *domain->giveDofManager( map ) ) {
if ( jdof->isPrimaryDof() && ( jdof->__giveEquationNumber() ) ) {
count++;
} else {
pcount++;
}
}
}
// --------------------------------------------------------------------------------
// only pcount is relevant here, since only prescribed components are exchanged !!!!
// --------------------------------------------------------------------------------
return ( buff.givePackSizeOfDouble(1) * pcount );
} else if ( packUnpackType == 1 ) {
for ( int map: commMap ) {
count += domain->giveElement( map )->estimatePackSize(buff);
}
return count;
}
return 0;
}
示例10: buildDofMap
void XFEMStatic :: buildDofMap()
{
printf("Building dof map.\n");
mDofEqnNumMap.clear();
for ( int domainIndex = 1; domainIndex <= this->giveNumberOfDomains(); domainIndex++ ) {
Domain *domain = this->giveDomain(domainIndex);
for ( int dManIndex = 1; dManIndex <= domain->giveNumberOfDofManagers(); dManIndex++ ) {
DofManager *dMan = domain->giveDofManager(dManIndex);
for ( Dof *dof: *dMan ) {
int eqNum = dof->giveEqn();
if ( eqNum > 0 ) {
std :: vector< int > key(3);
key [ 0 ] = domainIndex;
key [ 1 ] = dManIndex;
key [ 2 ] = dof->giveDofID();
mDofEqnNumMap [ key ] = eqNum;
}
}
}
}
}
示例11: unpackMigratingData
void
NonLinearStatic :: unpackMigratingData(TimeStep *tStep)
{
Domain *domain = this->giveDomain(1);
int ndofman = domain->giveNumberOfDofManagers();
//int myrank = this->giveRank();
// resize target arrays
int neq = this->giveNumberOfDomainEquations( 1, EModelDefaultEquationNumbering() );
totalDisplacement.resize(neq);
incrementOfDisplacement.resize(neq);
incrementalLoadVector.resize(neq);
initialLoadVector.resize(neq);
initialLoadVectorOfPrescribed.resize( giveNumberOfDomainEquations( 1, EModelDefaultPrescribedEquationNumbering() ) );
incrementalLoadVectorOfPrescribed.resize( giveNumberOfDomainEquations( 1, EModelDefaultPrescribedEquationNumbering() ) );
for ( int idofman = 1; idofman <= ndofman; idofman++ ) {
DofManager *_dm = domain->giveDofManager(idofman);
for ( Dof *_dof: *_dm ) {
if ( _dof->isPrimaryDof() ) {
int _eq;
if ( ( _eq = _dof->__giveEquationNumber() ) ) {
// pack values in solution vectors
totalDisplacement.at(_eq) = _dof->giveUnknownsDictionaryValue( tStep, VM_Total );
initialLoadVector.at(_eq) = _dof->giveUnknownsDictionaryValue( tStep, VM_RhsInitial );
incrementalLoadVector.at(_eq) = _dof->giveUnknownsDictionaryValue( tStep, VM_RhsIncremental );
#if 0
// debug print
if ( _dm->giveParallelMode() == DofManager_shared ) {
fprintf(stderr, "[%d] Shared: %d(%d) -> %d\n", myrank, idofman, idof, _eq);
} else {
fprintf(stderr, "[%d] Local : %d(%d) -> %d\n", myrank, idofman, idof, _eq);
}
#endif
} else if ( ( _eq = _dof->__givePrescribedEquationNumber() ) ) {
// pack values in prescribed solution vectors
initialLoadVectorOfPrescribed.at(_eq) = _dof->giveUnknownsDictionaryValue( tStep, VM_RhsInitial );
incrementalLoadVectorOfPrescribed.at(_eq) = _dof->giveUnknownsDictionaryValue( tStep, VM_RhsIncremental );
#if 0
// debug print
fprintf(stderr, "[%d] %d(%d) -> %d\n", myrank, idofman, idof, -_eq);
#endif
}
} // end primary dof
} // end dof loop
} // end dofman loop
this->initializeCommMaps(true);
nMethod->reinitialize();
// reinitialize error estimator (if any)
if ( this->giveDomainErrorEstimator(1) ) {
this->giveDomainErrorEstimator(1)->reinitialize();
}
initFlag = true;
}
示例12: doOutputData
void
MatlabExportModule :: doOutputData(TimeStep *tStep, FILE *FID)
{
Domain *domain = emodel->giveDomain(1);
std :: vector< int >DofIDList;
std :: vector< int > :: iterator it;
std :: vector< std :: vector< double > * >valuesList;
std :: vector< double > *values;
for ( int i = 1; i <= domain->giveNumberOfDofManagers(); i++ ) {
for ( int j = 1; j <= domain->giveDofManager(i)->giveNumberOfDofs(); j++ ) {
Dof *thisDof;
thisDof = domain->giveDofManager(i)->giveDof(j);
it = std :: find( DofIDList.begin(), DofIDList.end(), thisDof->giveDofID() );
if ( it == DofIDList.end() ) {
DofIDList.push_back( thisDof->giveDofID() );
values = new( std :: vector< double > );
valuesList.push_back(values);
} else {
int pos = it - DofIDList.begin();
values = valuesList.at(pos);
}
double value = thisDof->giveUnknown(EID_MomentumBalance, VM_Total, tStep);
values->push_back(value);
}
}
fprintf(FID, "\tdata.DofIDs=[");
for ( size_t i = 0; i < DofIDList.size(); i++ ) {
fprintf( FID, "%u, ", DofIDList.at(i) );
}
fprintf(FID, "];\n");
for ( size_t i = 0; i < valuesList.size(); i++ ) {
fprintf(FID, "\tdata.a{%lu}=[", static_cast<long unsigned int>(i) + 1);
for ( size_t j = 0; j < valuesList.at(i)->size(); j++ ) {
fprintf( FID, "%f,", valuesList.at(i)->at(j) );
}
fprintf(FID, "];\n");
}
}
示例13: printReactionForces
void
StructuralEngngModel :: printReactionForces(TimeStep *tStep, int di)
//
// computes and prints reaction forces in all supported or restrained dofs
//
{
IntArray ielemDofMask;
FloatArray reactions;
IntArray dofManMap, dofidMap, eqnMap;
Domain *domain = this->giveDomain(di);
// test if solution step output is active
if ( !domain->giveOutputManager()->testTimeStepOutput(tStep) ) {
return;
}
FILE *outputStream = this->giveOutputStream();
// map contains corresponding dofmanager and dofs numbers corresponding to prescribed equations
// sorted according to dofmanger number and as a minor crit. according to dof number
// this is necessary for extractor, since the sorted output is expected
this->buildReactionTable(dofManMap, dofidMap, eqnMap, tStep, di);
//
// print header
//
fprintf(outputStream, "\n\n\tR E A C T I O N S O U T P U T:\n\t_______________________________\n\n\n");
// compute reaction forces
this->computeReaction(reactions, tStep, di);
//
// loop over reactions and print them
//
for ( int i = 1; i <= dofManMap.giveSize(); i++ ) {
if ( domain->giveOutputManager()->testDofManOutput(dofManMap.at(i), tStep) ) {
fprintf( outputStream, "\tNode %8d iDof %2d reaction % .4e [bc-id: %d]\n",
domain->giveDofManager( dofManMap.at(i) )->giveLabel(),
dofidMap.at(i), reactions.at( eqnMap.at(i) ),
domain->giveDofManager( dofManMap.at(i) )->giveDofWithID( dofidMap.at(i) )->giveBcId() );
}
}
}
示例14: estimateMaxPackSize
int
NonLinearDynamic :: estimateMaxPackSize(IntArray &commMap, CommunicationBuffer &buff, int packUnpackType)
{
int mapSize = commMap.giveSize();
int i, j, ndofs, count = 0, pcount = 0;
IntArray locationArray;
Domain *domain = this->giveDomain(1);
DofManager *dman;
Dof *jdof;
if ( packUnpackType == ProblemCommMode__ELEMENT_CUT ) {
for ( i = 1; i <= mapSize; i++ ) {
count += domain->giveDofManager( commMap.at(i) )->giveNumberOfDofs();
}
return ( buff.givePackSize(MPI_DOUBLE, 1) * count );
} else if ( packUnpackType == ProblemCommMode__NODE_CUT ) {
for ( i = 1; i <= mapSize; i++ ) {
ndofs = ( dman = domain->giveDofManager( commMap.at(i) ) )->giveNumberOfDofs();
for ( j = 1; j <= ndofs; j++ ) {
jdof = dman->giveDof(j);
if ( jdof->isPrimaryDof() && ( jdof->__giveEquationNumber() ) ) {
count++;
} else {
pcount++;
}
}
}
//printf ("\nestimated count is %d\n",count);
return ( buff.givePackSize(MPI_DOUBLE, 1) * max(count, pcount) );
} else if ( packUnpackType == ProblemCommMode__REMOTE_ELEMENT_MODE ) {
for ( i = 1; i <= mapSize; i++ ) {
count += domain->giveElement( commMap.at(i) )->estimatePackSize(buff);
}
return count;
}
return 0;
}
示例15: estimateMaxPackSize
int
FreeWarping :: estimateMaxPackSize(IntArray &commMap, CommunicationBuffer &buff, int packUnpackType)
{
int count = 0, pcount = 0;
IntArray locationArray;
Domain *domain = this->giveDomain(1);
if ( packUnpackType == ProblemCommMode__ELEMENT_CUT ) {
for ( int map: commMap ) {
count += domain->giveDofManager( map )->giveNumberOfDofs();
}
return ( buff.givePackSize(MPI_DOUBLE, 1) * count );
} else if ( packUnpackType == ProblemCommMode__NODE_CUT ) {
for ( int map: commMap ) {
for ( Dof *jdof: *domain->giveDofManager( map ) ) {
if ( jdof->isPrimaryDof() && ( jdof->__giveEquationNumber() ) ) {
count++;
} else {
pcount++;
}
}
}
// --------------------------------------------------------------------------------
// only pcount is relevant here, since only prescribed components are exchanged !!!!
// --------------------------------------------------------------------------------
return ( buff.givePackSize(MPI_DOUBLE, 1) * pcount );
} else if ( packUnpackType == ProblemCommMode__REMOTE_ELEMENT_MODE ) {
for ( int map: commMap ) {
count += domain->giveElement( map )->estimatePackSize(buff);
}
return count;
}
return 0;
}