本文整理汇总了C++中ObjectArray::size方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectArray::size方法的具体用法?C++ ObjectArray::size怎么用?C++ ObjectArray::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectArray
的用法示例。
在下文中一共展示了ObjectArray::size方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetCount
//------------------------------------------------------------------------------
Integer StateManager::GetCount(Gmat::StateElementId elementType)
{
ObjectArray pObjects;
GetStateObjects(pObjects, Gmat::UNKNOWN_OBJECT);
Integer count = pObjects.size();
#ifdef DEBUG_STATE_ACCESS
MessageInterface::ShowMessage(
"StateManager::GetCount found %d objects supporting type %d\n",
count, elementType);
#endif
return count;
}
示例2: CompleteInitialization
//------------------------------------------------------------------------------
void BatchEstimator::CompleteInitialization()
{
#ifdef WALK_STATE_MACHINE
MessageInterface::ShowMessage("BatchEstimator state is INITIALIZING\n");
#endif
if (showAllResiduals)
{
StringArray plotMeasurements;
for (UnsignedInt i = 0; i < measurementNames.size(); ++i)
{
plotMeasurements.clear();
plotMeasurements.push_back(measurementNames[i]);
std::string plotName = instanceName + "_" + measurementNames[i] +
"_Residuals";
BuildResidualPlot(plotName, plotMeasurements);
}
}
if (advanceToEstimationEpoch == false)
{
PropagationStateManager *psm = propagator->GetPropStateManager();
GmatState *gs = psm->GetState();
estimationState = esm.GetState();
stateSize = estimationState->GetSize();
Estimator::CompleteInitialization();
// If estimation epoch not set, use the epoch from the prop state
if ((estEpochFormat == "FromParticipants") || (estimationEpoch <= 0.0))
{
ObjectArray participants;
esm.GetStateObjects(participants, Gmat::SPACEOBJECT);
for (UnsignedInt i = 0; i < participants.size(); ++i)
estimationEpoch = ((SpaceObject *)(participants[i]))->GetEpoch();
}
currentEpoch = gs->GetEpoch();
// Tell the measManager to complete its initialization
bool measOK = measManager.Initialize();
if (!measOK)
throw SolverException(
"BatchEstimator::CompleteInitialization - error initializing "
"MeasurementManager.\n");
// Now load up the observations
measManager.PrepareForProcessing();
measManager.LoadObservations();
if (!GmatMathUtil::IsEqual(currentEpoch, estimationEpoch))
{
advanceToEstimationEpoch = true;
nextMeasurementEpoch = estimationEpoch;
currentState = PROPAGATING;
return;
}
}
advanceToEstimationEpoch = false;
// First measurement epoch is the epoch of the first measurement. Duh.
nextMeasurementEpoch = measManager.GetEpoch();
#ifdef DEBUG_INITIALIZATION
MessageInterface::ShowMessage(
"Init complete!\n STM = %s\n Covariance = %s\n",
stm->ToString().c_str(), covariance->ToString().c_str());
#endif
hAccum.clear();
if (useApriori)
{
information = stateCovariance->GetCovariance()->Inverse();
}
else
{
information.SetSize(stateSize, stateSize);
for (UnsignedInt i = 0; i < stateSize; ++i)
for (UnsignedInt j = 0; j < stateSize; ++j)
information(i,j) = 0.0;
}
residuals.SetSize(stateSize);
x0bar.SetSize(stateSize);
measurementResiduals.clear();
measurementEpochs.clear();
for (Integer i = 0; i < information.GetNumRows(); ++i)
{
residuals[i] = 0.0;
if (useApriori)
x0bar[i] = (*estimationState)[i];
else
x0bar[i] = 0.0;
}
if (useApriori)
for (Integer i = 0; i < information.GetNumRows(); ++i)
//.........这里部分代码省略.........
示例3: SetTankFromSpacecraft
//------------------------------------------------------------------------------
// bool SetTankFromSpacecraft()
//------------------------------------------------------------------------------
bool ImpulsiveBurn::SetTankFromSpacecraft()
{
#ifdef DEBUG_IMPBURN_SET
MessageInterface::ShowMessage
("ImpulsiveBurn::SetTankFromSpacecraft() entered, spacecraft=<%p>'%s'\n",
spacecraft, spacecraft ? spacecraft->GetName().c_str() : "NULL");
MessageInterface::ShowMessage(" tankNames.size()=%d\n", tankNames.size());
#endif
if (spacecraft == NULL)
return false;
if (tankNames.empty())
throw BurnException("ImpulsiveBurn::Initialize() " + instanceName +
" has no associated tank");
ObjectArray tankArray = spacecraft->GetRefObjectArray(Gmat::FUEL_TANK);
#ifdef DEBUG_IMPBURN_SET
MessageInterface::ShowMessage
(" spacecraft tankArray.size()=%d\n", tankArray.size());
#endif
if (!tankNames.empty() && !tankArray.empty())
{
ObjectArray::iterator scTank = tankArray.begin();
// Find the tank on the spacecraft
for (StringArray::iterator tankName = tankNames.begin();
tankName != tankNames.end(); ++tankName)
{
while (scTank != tankArray.end())
{
#ifdef DEBUG_IMPBURN_SET
MessageInterface::ShowMessage
(" The tank '%s' associated with spacecraft is <%p>'%s'\n",
(*tankName).c_str(), (*scTank),
(*scTank) ? (*scTank)->GetName().c_str() : "NULL");
#endif
// Just in case, check for NULL tank pointer
if (*scTank == NULL)
continue;
// Assign the tank
if ((*scTank)->GetName() == *tankName)
{
tankMap[*tankName] = (*scTank);
#ifdef DEBUG_IMPBURN_SET
MessageInterface::ShowMessage
(" Assigned <%p>'%s' to tankMap\n", *scTank, (*tankName).c_str());
#endif
}
++scTank;
}
}
if (tankNames.size() != tankMap.size())
throw BurnException("The impulsive burn " + instanceName +
" could not find the fuel tank needed to deplete mass; please "
"attach the tank to the spacecraft " + spacecraft->GetName() +
" or turn off mass depletion.");
}
#ifdef DEBUG_IMPBURN_SET
MessageInterface::ShowMessage
("ImpulsiveBurn::SetTankFromSpacecraft() returning true\n");
#endif
return true;
}
示例4: writeChartContents
/*****************************************************
**
** BasicVedicChart --- writeChartContents
**
******************************************************/
void BasicVedicChart::writeChartContents( const int &chart_id, const bool applyFilter )
{
ObjectId planet;
uint f;
wxString lname, sname, symbol, av;
bool retro, avmode;
SymbolProvider sp;
SheetFormatter fmt;
if ( chart_id == 0 && ! h1set ) printf( "WARN BasicVedicChart::writeChartContents no chart set for id 0\n" );
if ( chart_id == 1 && ! h2set ) printf( "WARN BasicVedicChart::writeChartContents no chart set for id 1\n" );
ObjectArray o = applyFilter ? chartprops->getVedicPlanetList( chartprops->getObjectFilter()) : obs;
for ( uint i = 0; i < o.size(); i++ )
{
planet = o[i];
// do not paint ascendant in north indian chart
if ( field_count == 12 && chart_id == 0 && planet == OASCENDANT && chartprops->getVedicChartDisplayConfig().indianChartType == VCT_NORTH ) continue;
// do not paint ascendant in south indian chart if markup of AS is enabled
if ( field_count == 12 && ! h2set && planet == OASCENDANT && chartprops->getVedicChartDisplayConfig().southIndianAscendantMarkup ) continue;
f = a_red( getPlanetField( planet, chart_id ) - positionOffset, field_count );
//printf( "positionOffset %d\n", positionOffset );
assert( f < fields.size());
ChartContents &cc = fields[f].getContents( chart_id );
cc.planets.push_back( planet );
lname = fmt.getObjectNamePlain( planet, TF_LONG, true );
sname = fmt.getObjectNamePlain( planet, TF_MEDIUM, true );
// retrogression
retro = ( chartprops->getVedicChartDisplayConfig().showRetro ) && getPlanetRetro( planet, chart_id )
&& planet != OMEANNODE && planet != OMEANDESCNODE;
if ( retro )
{
//lname += wxT( " " );
lname += wxT( "(R)" );
sname += wxT( "R" );
}
// see if transit mode, varga, av and valid planet
avmode = ( IS_AVPLANET( planet )
&& charttype == CT_TRANSIT
&& chart_id == 1
&& field_count == 12
&& chartprops->getVedicChartDisplayConfig().showAshtakavarga );
if ( avmode )
{
av = wxString::Format( wxT( " %d" ), getAshtakavargaPoints( planet, f ));
sname += av;
lname += av;
}
// symbol
symbol.Clear();
if ( ! avmode && config->writer->planetSymbols && getVChartConfig()->useSymbols && planet <= MAX_EPHEM_OBJECTS ) symbol = sp.getPlanetCode( planet );
if ( ! symbol.IsEmpty() )
{
cc.graphicitems.push_back( ChartGraphicItem( symbol, planet, retro ));
}
else
{
ChartTextItem item( lname, sname, retro );
cc.textitems.push_back( item );
}
}
}