本文整理汇总了C++中ActionFrame类的典型用法代码示例。如果您正苦于以下问题:C++ ActionFrame类的具体用法?C++ ActionFrame怎么用?C++ ActionFrame使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ActionFrame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HistAction
// Action_Density::HistAction()
Action::RetType Action_Density::HistAction(int frameNum, ActionFrame& frm) {
long int bin = 0;
// Loop over masks
for (unsigned int idx = 0; idx != masks_.size(); ++idx)
{
AtomMask const& mask = masks_[idx];
HistType& hist = histograms_[idx];
std::map<long int, double> Sum;
// Loop over mask atoms
unsigned int midx = 0;
for (AtomMask::const_iterator atm = mask.begin(); atm != mask.end(); ++atm, midx++)
{
const double* XYZ = frm.Frm().XYZ( *atm );
if (XYZ[axis_] < 0) {
// Coordinate is negative. Need to subtract off delta so that proper bin
// is populated (-delta to 0.0).
bin = (XYZ[axis_] - delta_) / delta_;
} else {
// Coordinate is positive.
bin = XYZ[axis_] / delta_;
}
//mprintf("DEBUG: frm=%6i mask=%3u atm=%8i crd=%8.3f bin=%li\n", frameNum+1, idx, *atm+1, XYZ[axis_], bin);
Sum[bin] += properties_[idx][midx];
}
// Accumulate sums
hist.accumulate( Sum );
}
// Accumulate area
Box const& box = frm.Frm().BoxCrd();
area_.accumulate(box[area_coord_[0]] * box[area_coord_[1]]);
return Action::OK;
}
示例2: DoAction
// Action_Distance::DoAction()
Action::RetType Action_Distance::DoAction(int frameNum, ActionFrame& frm) {
double Dist;
Matrix_3x3 ucell, recip;
Vec3 a1, a2;
if (useMass_) {
a1 = frm.Frm().VCenterOfMass( Mask1_ );
a2 = frm.Frm().VCenterOfMass( Mask2_ );
} else {
a1 = frm.Frm().VGeometricCenter( Mask1_ );
a2 = frm.Frm().VGeometricCenter( Mask2_ );
}
switch ( image_.ImageType() ) {
case NONORTHO:
frm.Frm().BoxCrd().ToRecip(ucell, recip);
Dist = DIST2_ImageNonOrtho(a1, a2, ucell, recip);
break;
case ORTHO:
Dist = DIST2_ImageOrtho(a1, a2, frm.Frm().BoxCrd());
break;
case NOIMAGE:
Dist = DIST2_NoImage(a1, a2);
break;
}
Dist = sqrt(Dist);
dist_->Add(frameNum, &Dist);
return Action::OK;
}
示例3: getFirstFrameIndex
int ActionNode::getFirstFrameIndex()
{
int frameindex = 99999;
bool bFindFrame = false;
for (int n = 0; n < _frameArrayNum; n++)
{
Array* cArray = (Array*)(_frameArray->getObjectAtIndex(n));
if (cArray == NULL || cArray->count() <= 0)
{
continue;
}
bFindFrame = true;
ActionFrame* frame = (ActionFrame*)(cArray->getObjectAtIndex(0));
int iFrameIndex = frame->getFrameIndex();
if (frameindex > iFrameIndex)
{
frameindex = iFrameIndex;
}
}
if (!bFindFrame)
{
frameindex = 0;
}
return frameindex;
}
示例4: DoAction
Action::RetType Action_AtomicCorr::DoAction(int frameNum, ActionFrame& frm) {
// On first pass through refframe will be empty and first frame will become ref.
if (!previousFrame_.empty()) {
ACvector::iterator atom_vector = atom_vectors_.begin();
if (acorr_mode_ == ATOM) {
// For each atom in mask, calc delta position.
for (AtomMask::const_iterator atom = mask_.begin(); atom != mask_.end(); ++atom)
{
const double* tgtxyz = frm.Frm().XYZ( *atom );
const double* refxyz = previousFrame_.XYZ( *atom );
atom_vector->push_back( (float)(tgtxyz[0] - refxyz[0]) );
atom_vector->push_back( (float)(tgtxyz[1] - refxyz[1]) );
atom_vector->push_back( (float)(tgtxyz[2] - refxyz[2]) );
++atom_vector;
}
} else {
for (std::vector<AtomMask>::const_iterator rmask = resmasks_.begin();
rmask != resmasks_.end(); ++rmask)
{
Vec3 CXYZ = frm.Frm().VGeometricCenter( *rmask );
Vec3 RXYZ = previousFrame_.VGeometricCenter( *rmask );
atom_vector->push_back( (float)(CXYZ[0] - RXYZ[0]) );
atom_vector->push_back( (float)(CXYZ[1] - RXYZ[1]) );
atom_vector->push_back( (float)(CXYZ[2] - RXYZ[2]) );
++atom_vector;
}
}
}
// Store this frame as new reference frame
previousFrame_ = frm.Frm();
return Action::OK;
}
示例5: DoAction
// Action_CreateReservoir::DoAction()
Action::RetType Action_CreateReservoir::DoAction(int frameNum, ActionFrame& frm) {
int bin = -1;
if (bin_ != 0) bin = (int)bin_->Dval(frm.TrajoutNum());
if (reservoir_.WriteReservoir(nframes_++, frm.Frm(), ene_->Dval(frm.TrajoutNum()), bin))
return Action::ERR;
return Action::OK;
}
示例6: getLastFrameIndex
int ActionNode::getLastFrameIndex()
{
int frameindex = -1;
bool bFindFrame = false;
for (int n = 0; n < frameArrayNum; n++)
{
CCArray* cArray = (CCArray*)(m_FrameArray->objectAtIndex(n));
if (cArray == NULL || cArray->count() <= 0)
{
continue;
}
bFindFrame = true;
int lastInex = cArray->count() - 1;
ActionFrame* frame = (ActionFrame*)(cArray->objectAtIndex(lastInex));
int iFrameIndex = frame->getFrameIndex();
if (frameindex < iFrameIndex)
{
frameindex = iFrameIndex;
}
}
if (!bFindFrame)
{
frameindex = 0;
}
return frameindex;
}
示例7: DoAction
// Action_Principal::DoAction()
Action::RetType Action_Principal::DoAction(int frameNum, ActionFrame& frm) {
Matrix_3x3 Inertia;
Vec3 Eval;
frm.Frm().CalculateInertia( mask_, Inertia );
// NOTE: Diagonalize_Sort_Chirality places sorted eigenvectors in rows.
Inertia.Diagonalize_Sort_Chirality( Eval, debug_ );
if (outfile_ != 0) {
int fn = frameNum+1;
outfile_->Printf("%i EIGENVALUES: %f %f %f\n%i EIGENVECTOR 0: %f %f %f\n%i EIGENVECTOR 1: %f %f %f\n%i EIGENVECTOR 2: %f %f %f\n",
fn, Eval[0], Eval[1], Eval[2],
fn, Inertia[0], Inertia[1], Inertia[2],
fn, Inertia[3], Inertia[4], Inertia[5],
fn, Inertia[6], Inertia[7], Inertia[8]);
//Eval.Print("PRINCIPAL EIGENVALUES");
//Inertia.Print("PRINCIPAL EIGENVECTORS (Rows)");
}
if (vecData_ != 0) {
vecData_->AddMat3x3( Inertia );
valData_->AddVxyz( Eval );
}
// Rotate - since Evec is already transposed (eigenvectors
// are returned in rows) just do plain rotation to affect an
// inverse rotation.
if (doRotation_) {
frm.ModifyFrm().Rotate( Inertia );
return Action::MODIFY_COORDS;
}
return Action::OK;
}
示例8: DoAction
// Action_CheckStructure::DoAction()
Action::RetType Action_CheckStructure::DoAction(int frameNum, ActionFrame& frm) {
int total_problems = CheckOverlap(frameNum+1, frm.Frm(), *CurrentParm_);
if (bondcheck_)
total_problems += CheckBonds(frameNum+1, frm.Frm(), *CurrentParm_);
if (total_problems > 0 && skipBadFrames_)
return Action::SUPPRESS_COORD_OUTPUT;
return Action::OK;
}
示例9: DoAction
/** Called every time a frame is read in. Calc distance RMSD.
* If first is true, set the first frame read in as reference.
*/
Action::RetType Action_DistRmsd::DoAction(int frameNum, ActionFrame& frm) {
// Perform any needed reference actions
refHolder_.ActionRef( frm.Frm(), false, false );
// Set selected frame atoms. Masses have already been set.
SelectedTgt_.SetCoordinates(frm.Frm(), TgtMask_);
double DR = SelectedTgt_.DISTRMSD( refHolder_.SelectedRef() );
drmsd_->Add(frameNum, &DR);
return Action::OK;
}
示例10: DoAction
// Action_DihedralScan::DoAction()
Action::RetType Action_DihedralScan::DoAction(int frameNum, ActionFrame& frm) {
switch (mode_) {
case RANDOM: RandomizeAngles(frm.ModifyFrm()); break;
case INTERVAL: IntervalAngles(frm.ModifyFrm()); break;
}
// Check the resulting structure
int n_problems = checkStructure_.CheckOverlap( frameNum+1, frm.Frm(), *CurrentParm_ );
//mprintf("%i\tResulting structure has %i problems.\n",frameNum,n_problems);
number_of_problems_->Add(frameNum, &n_problems);
return Action::OK;
}
示例11: getUnitTime
Spawn * ActionNode::refreshActionProperty()
{
if ( _object == NULL )
{
return NULL;
}
Array* cSpawnArray = Array::create();
for (int n = 0; n < _frameArrayNum; n++)
{
Array* cArray = (Array*)(_frameArray->getObjectAtIndex(n));
if (cArray == NULL || cArray->count() <= 0)
{
continue;
}
Array* cSequenceArray = Array::create();
int frameCount = cArray->count();
for (int i = 0; i < frameCount; i++)
{
ActionFrame* frame = (ActionFrame*)(cArray->getObjectAtIndex(i));
if (i == 0)
{
}
else
{
ActionFrame* srcFrame = (ActionFrame*)(cArray->getObjectAtIndex(i-1));
float duration = (frame->getFrameIndex() - srcFrame->getFrameIndex()) * getUnitTime();
Action* cAction = frame->getAction(duration);
cSequenceArray->addObject(cAction);
}
}
Sequence* cSequence = Sequence::create(cSequenceArray);
if (cSequence != NULL)
{
cSpawnArray->addObject(cSequence);
}
}
if (_action == NULL)
{
CC_SAFE_RELEASE_NULL(_actionSpawn);
}
else
{
CC_SAFE_RELEASE_NULL(_action);
}
_actionSpawn = Spawn::create(cSpawnArray);
CC_SAFE_RETAIN(_actionSpawn);
return _actionSpawn;
}
示例12: DensityAction
// Action_Density::DensityAction()
Action::RetType Action_Density::DensityAction(int frameNum, ActionFrame& frm) {
Matrix_3x3 ucell, recip;
double volume = 0.0;
if (image_.ImageType() == ORTHO)
volume = frm.Frm().BoxCrd().BoxX() *
frm.Frm().BoxCrd().BoxY() *
frm.Frm().BoxCrd().BoxZ();
else if (image_.ImageType() == NONORTHO)
volume = frm.Frm().BoxCrd().ToRecip( ucell, recip );
// Total mass is in delta_
double density = delta_ / (volume * AMU_ANG_TO_G_CM3);
density_->Add(frameNum, &density);
return Action::OK;
}
示例13: DoAction
/** If a dataset was specified for maxmin, check if this structure
* satisfies the criteria; if so, write. Otherwise just write.
*/
Action::RetType Action_Outtraj::DoAction(int frameNum, ActionFrame& frm) {
// If dataset defined, check if frame is within max/min
if (!Dsets_.empty()) {
for (unsigned int ds = 0; ds < Dsets_.size(); ++ds)
{
double dVal = Dsets_[ds]->Dval(frameNum);
//mprintf("DBG: maxmin[%u]: dVal = %f, min = %f, max = %f\n",ds,dVal,Min_[ds],Max_[ds]);
// If value from dataset not within min/max, exit now.
if (dVal < Min_[ds] || dVal > Max_[ds]) return Action::OK;
}
}
if (outtraj_.WriteSingle(frm.TrajoutNum(), frm.Frm())) return Action::ERR;
return Action::OK;
}
示例14: DoAction
// Action_LIE::action()
Action::RetType Action_LIE::DoAction(int frameNum, ActionFrame& frm) {
if (doelec_) {
double e = Calculate_Elec(frm.Frm());
elec_->Add(frameNum, &e);
}
if (dovdw_) {
double e = Calculate_LJ(frm.Frm(), *CurrentParm_);
vdw_->Add(frameNum, &e);
}
return Action::OK;
}
示例15: if
bool ActionNode::updateActionToTimeLine(float fTime)
{
bool bFindFrame = false;
ActionFrame* srcFrame = nullptr;
// ActionFrame* destFrame = nullptr;
for (int n = 0; n < _frameArrayNum; n++)
{
auto cArray = _frameArray.at(n);
if (cArray->empty())
{
continue;
}
ssize_t frameCount = cArray->size();
for (int i = 0; i < frameCount; i++)
{
auto frame = cArray->at(i);
if (frame->getFrameIndex()*getUnitTime() == fTime)
{
this->easingToFrame(1.0f,1.0f,nullptr,frame);
bFindFrame = true;
break;
}
else if (frame->getFrameIndex()*getUnitTime() > fTime)
{
if (i == 0)
{
this->easingToFrame(1.0f,1.0f,nullptr,frame);
bFindFrame = false;
}
else
{
srcFrame = cArray->at(i-1);
float duration = (frame->getFrameIndex() - srcFrame->getFrameIndex())*getUnitTime();
float delaytime = fTime - srcFrame->getFrameIndex()*getUnitTime();
this->easingToFrame(duration,1.0f,nullptr,srcFrame);
//float easingTime = ActionFrameEasing::bounceTime(delaytime);
this->easingToFrame(duration,delaytime/duration,srcFrame,frame);
bFindFrame = true;
}
break;
}
}
}
return bFindFrame;
}