本文整理汇总了C++中DofManager::giveNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ DofManager::giveNumber方法的具体用法?C++ DofManager::giveNumber怎么用?C++ DofManager::giveNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DofManager
的用法示例。
在下文中一共展示了DofManager::giveNumber方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initializeSurfaceData
void
SolutionbasedShapeFunction :: initializeSurfaceData(modeStruct *mode)
{
EngngModel *m = mode->myEngngModel;
double TOL2 = 1e-5;
IntArray pNodes, mNodes, zNodes;
Set *mySet = this->domain->giveSet( this->giveSetNumber() );
IntArray BoundaryList = mySet->giveBoundaryList();
// First add all nodes to pNodes or nNodes respectively depending on coordinate and normal.
for ( int i = 0; i < BoundaryList.giveSize() / 2; i++ ) {
int ElementID = BoundaryList(2 * i);
int Boundary = BoundaryList(2 * i + 1);
Element *e = m->giveDomain(1)->giveElement(ElementID);
FEInterpolation *geoInterpolation = e->giveInterpolation();
// Check all sides of element
IntArray bnodes;
#define usePoints 1
#if usePoints == 1
// Check if all nodes are on the boundary
geoInterpolation->boundaryGiveNodes(bnodes, Boundary);
for ( int k = 1; k <= bnodes.giveSize(); k++ ) {
DofManager *dman = e->giveDofManager( bnodes.at(k) );
for ( int l = 1; l <= dman->giveCoordinates()->giveSize(); l++ ) {
if ( fabs( dman->giveCoordinates()->at(l) - maxCoord.at(l) ) < TOL2 ) {
pNodes.insertOnce( dman->giveNumber() );
}
if ( fabs( dman->giveCoordinates()->at(l) - minCoord.at(l) ) < TOL2 ) {
mNodes.insertOnce( dman->giveNumber() );
}
}
}
#else
// Check normal
FloatArray lcoords;
lcoords.resize(2);
lcoords.at(1) = 0.33333;
lcoords.at(2) = 0.33333;
FloatArray normal;
geoInterpolation->boundaryEvalNormal( normal, j, lcoords, FEIElementGeometryWrapper(e) );
geoInterpolation->boundaryGiveNodes(bnodes, j);
printf( "i=%u\tj=%u\t(%f\t%f\t%f)\n", i, j, normal.at(1), normal.at(2), normal.at(3) );
for ( int k = 1; k <= normal.giveSize(); k++ ) {
if ( fabs( ( fabs( normal.at(k) ) - 1 ) ) < 1e-4 ) { // Points in x, y or z direction
addTo = NULL;
if ( normal.at(k) > 0.5 ) {
addTo = & pNodes;
}
if ( normal.at(k) < -0.5 ) {
addTo = & mNodes;
}
if ( addTo != NULL ) {
for ( int l = 1; l <= bnodes.giveSize(); l++ ) {
bool isSurface = false;
DofManager *dman = e->giveDofManager( bnodes.at(l) );
dman->giveCoordinates()->printYourself();
for ( int m = 1; m <= dman->giveCoordinates()->giveSize(); m++ ) {
if ( ( fabs( dman->giveCoordinates()->at(m) - maxCoord.at(m) ) < TOL2 ) || ( fabs( dman->giveCoordinates()->at(m) - minCoord.at(m) ) < TOL2 ) ) {
isSurface = true;
}
}
if ( isSurface ) {
addTo->insertOnce( e->giveDofManagerNumber( bnodes.at(l) ) );
}
}
}
}
}
#endif
}
#if 0
printf("p=[");
for ( int i = 1; i < pNodes.giveSize(); i++ ) {
printf( "%u, ", pNodes.at(i) );
}
printf("];\n");
printf("m=[");
for ( int i = 1; i < mNodes.giveSize(); i++ ) {
printf( "%u, ", mNodes.at(i) );
}
printf("];\n");
#endif
//The intersection of pNodes and mNodes constitutes zNodes
{
int i = 1, j = 1;
while ( i <= pNodes.giveSize() ) {
j = 1;
while ( j <= mNodes.giveSize() && ( i <= pNodes.giveSize() ) ) {
//printf("%u == %u?\n", pNodes.at(i), mNodes.at(j));
if ( pNodes.at(i) == mNodes.at(j) ) {
zNodes.insertOnce( pNodes.at(i) );
pNodes.erase(i);
//.........这里部分代码省略.........
示例2: exportPrimVarAs
void
VTKXMLExportModule :: exportPrimVarAs(UnknownType valID, IntArray &mapG2L, IntArray &mapL2G,
int regionDofMans, int ireg,
#ifdef __VTK_MODULE
vtkSmartPointer<vtkUnstructuredGrid> &stream,
#else
FILE *stream,
#endif
TimeStep *tStep)
{
Domain *d = emodel->giveDomain(1);
InternalStateValueType type = ISVT_UNDEFINED;
if ( ( valID == DisplacementVector ) || ( valID == EigenVector ) || ( valID == VelocityVector ) ) {
type = ISVT_VECTOR;
} else if ( ( valID == FluxVector ) || ( valID == PressureVector ) || ( valID == Temperature ) ) {
type = ISVT_SCALAR;
} else {
OOFEM_ERROR2( "VTKXMLExportModule::exportPrimVarAs: unsupported UnknownType %s", __UnknownTypeToString(valID) );
}
#ifdef __VTK_MODULE
vtkSmartPointer<vtkDoubleArray> primVarArray = vtkSmartPointer<vtkDoubleArray>::New();
primVarArray->SetName(__UnknownTypeToString(valID));
if ( type == ISVT_SCALAR ) {
primVarArray->SetNumberOfComponents(1);
} else if ( type == ISVT_VECTOR ) {
primVarArray->SetNumberOfComponents(3);
} else {
fprintf( stderr, "VTKXMLExportModule::exportPrimVarAs: unsupported variable type %s\n", __UnknownTypeToString(valID) );
}
primVarArray->SetNumberOfTuples(regionDofMans);
#else
if ( type == ISVT_SCALAR ) {
fprintf( stream, "<DataArray type=\"Float64\" Name=\"%s\" format=\"ascii\"> ", __UnknownTypeToString(valID) );
} else if ( type == ISVT_VECTOR ) {
fprintf( stream, "<DataArray type=\"Float64\" Name=\"%s\" NumberOfComponents=\"3\" format=\"ascii\"> ", __UnknownTypeToString(valID) );
} else {
fprintf( stderr, "VTKXMLExportModule::exportPrimVarAs: unsupported variable type %s\n", __UnknownTypeToString(valID) );
}
#endif
DofManager *dman;
FloatArray iVal, iValLCS;
for ( int inode = 1; inode <= regionDofMans; inode++ ) {
dman = d->giveNode( mapL2G.at(inode) );
this->getPrimaryVariable(iVal, dman, tStep, valID, ireg);
if ( type == ISVT_SCALAR ) {
#ifdef __VTK_MODULE
primVarArray->SetTuple1(inode-1, iVal.at(1));
#else
fprintf(stream, "%e ", iVal.at(1) );
#endif
} else if ( type == ISVT_VECTOR ) {
//rotate back from nodal CS to global CS if applies
if ( (dman->giveClassID() == NodeClass) && d->giveNode( dman->giveNumber() )->hasLocalCS() ) {
iVal.resize(3);
iValLCS = iVal;
iVal.beTProductOf(* d->giveNode( dman->giveNumber() )->giveLocalCoordinateTriplet(), iValLCS);
}
#ifdef __VTK_MODULE
primVarArray->SetTuple3(inode-1, iVal.at(1), iVal.at(2), iVal.at(3));
#else
fprintf( stream, "%e %e %e ", iVal.at(1), iVal.at(2), iVal.at(3) );
#endif
}
} // end loop over nodes
#ifdef __VTK_MODULE
if ( type == ISVT_SCALAR ) {
stream->GetPointData()->SetActiveScalars(__UnknownTypeToString(valID));
stream->GetPointData()->SetScalars(primVarArray);
} else if ( type == ISVT_VECTOR ) {
stream->GetPointData()->SetActiveVectors(__UnknownTypeToString(valID));
stream->GetPointData()->SetVectors(primVarArray);
}
#else
fprintf(stream, "</DataArray>\n");
#endif
}