本文整理汇总了C++中Model::GetNumNodes方法的典型用法代码示例。如果您正苦于以下问题:C++ Model::GetNumNodes方法的具体用法?C++ Model::GetNumNodes怎么用?C++ Model::GetNumNodes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model
的用法示例。
在下文中一共展示了Model::GetNumNodes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetOptimizationPdvsAndAdvs
//.........这里部分代码省略.........
// if ( node )
// {
// // If found in no filter IDs.
// if ( std::find( &noFilterNodeIds[0], &noFilterNodeIds[0] + ( UInt ) noFilterNodeIds.size(), glbNodeId ) - &noFilterNodeIds[0] != ( UInt ) noFilterNodeIds.size() ) {
// UInt numEntries[] = {1,0};
//
// neigbIdsVec[0] = glbNodeId - 1;
// neigbWgtVec[0] = 1.0;
//
// UInt paramIndex = 0;
// UInt propTypeKey = node->GetIndexNum();
// PhysicalDesignVar* pdv = aOptimizer->CreatePhysDesVar( aProblem, modelId, desDepObj, propId, propType, propTypeKey, paramIndex );
//
// Function* PDVEvalFunc = new FunctionScalarProduct( numEntries, &neigbWgtVec[0] );
// pdv->CreateEvaluationFunction( PDVEvalFunc, &neigbIdsVec[0] );
// }
// else {
// Real neighborIds = 0;
// Real neighborWgt = 0;
// UInt position = 28;
// for ( UInt ii = 0; ii < numNeigb; ii++ )
// {
// std::sscanf( lineChar + position,"%lf",&neighborIds );
// neigbIdsVec[ii] = neighborIds - 1;
// position += 14;
// }
// for ( UInt ii = 0; ii < numNeigb; ii++ )
// {
// std::sscanf( lineChar + position,"%lf",&neighborWgt );
// neigbWgtVec[ii] = neighborWgt;
// position += 14;
// }
//
// UInt numEntries[] = {numNeigb, 0};
// UInt paramIndex = 0;
// UInt propTypeKey = node->GetIndexNum();
// PhysicalDesignVar* pdv = aOptimizer->CreatePhysDesVar( aProblem, modelId, desDepObj, propId, propType, propTypeKey, paramIndex );
//
// Function* PDVEvalFunc = new FunctionScalarProduct( numEntries, &neigbWgtVec[0] );
// pdv->CreateEvaluationFunction( PDVEvalFunc, &neigbIdsVec[0] );
// }
// }
// }
// }
// }
// else
// {
// std::fprintf( stdout, " Unable to open file!!!\n" );
// }
// Set number of abstract design variables (radius)
UInt modelId = 1;
UInt numAbsDesVar = 1;
UInt AbsDesVarInd[] = {0};
// ------------------------------------------------------------------------
// Set number of abstract design variables
aOptimizer->SetNumDesVars(numAbsDesVar);
// ------------------------------------------------------------------------
// Create PDV's
DesignDepObject desDepObj = NOD_PROP;
UInt propId = 11;
Int propType = NP_LS;
PhysicalDesignVar* pdv = NULL;
// Create optimizer sweep function
UInt numParameters[] = { 1, 1 }; // number of coefficients and independent variables
Real ParameterVals[] = { 0.0 }; // radius and center of circle
Real CntrXGlbCoords = sCenterX;
Real CntrYGlbCoords = sCenterY;
Real CntrZGlbCoords = sCenterZ;
Model* model = aProblem->GetModelById(modelId);
UInt numNodes = model->GetNumNodes();
model->BuildNodeToElementTable();
Node* node = NULL;
Real NodeXGlbCoords = 0.0;
Real NodeYGlbCoords = 0.0;
Real NodeZGlbCoords = 0.0;
for ( UInt in = 0; in < numNodes; ++in )
{
node = model->GetNode(in);
NodeXGlbCoords = node->GetGlobalXCoord();
NodeYGlbCoords = node->GetGlobalYCoord();
NodeZGlbCoords = node->GetGlobalZCoord();
Real distance = std::sqrt( std::pow((NodeXGlbCoords-CntrXGlbCoords),2) + std::pow((NodeYGlbCoords-CntrYGlbCoords),2) + std::pow((NodeZGlbCoords-CntrZGlbCoords),2));
ParameterVals[0] = distance;
// Parameters for moving circle will be [distance, xcoords of node, ycoords of node, zcoords of node]
pdv = aOptimizer->CreatePhysDesVar(aProblem,modelId,desDepObj,propId,propType,node->GetIndexNum());
Function* SweepFunc = new FunctionUserDefined(numParameters,ParameterVals,mySweepFunc,mySweepFuncDeriv);
pdv->CreateEvaluationFunction(SweepFunc,AbsDesVarInd);
}
}