当前位置: 首页>>代码示例>>C++>>正文


C++ Phase类代码示例

本文整理汇总了C++中Phase的典型用法代码示例。如果您正苦于以下问题:C++ Phase类的具体用法?C++ Phase怎么用?C++ Phase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Phase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PhaseTotals

 PhaseTotals() {
   total_circstats.Clear();
   left_circstats.Clear();
   right_circstats.Clear();
   mixed_circstats.Clear();
   total_cruisestats.Clear();
 }
开发者ID:Advi42,项目名称:XCSoar,代码行数:7,代码来源:FlightPhaseDetector.hpp

示例2: connectCalls

void Entry::connectCalls()
{
    for ( std::map<unsigned, Phase*>::const_iterator next_phase = _phases.begin(); next_phase != _phases.end(); ++next_phase ) {
	Phase * phase = next_phase->second;
	phase->connectCalls( _src_arcs );
    }
}
开发者ID:layeredqueuing,项目名称:V5,代码行数:7,代码来源:entry.cpp

示例3: FileName

std::string Base::FileName(Phase const& phase) const
{
    INFO0;
    switch (phase.Tag()) {
    case Tag::signal : return SignalFileName(phase.Stage());
    case Tag::background : return BackgroundFileName(phase.Stage());
        DEFAULT(boca::Name(phase.Tag()), "");
    }
}
开发者ID:BoostedColliderAnalysis,项目名称:BoCA,代码行数:9,代码来源:Base.cpp

示例4: WriteCruiseStats

static void
WriteCruiseStats(TextWriter &writer, const Phase &stats)
{
  JSON::ObjectWriter object(writer);
  object.WriteElement("alt_diff", JSON::WriteInteger, (int)stats.alt_diff);
  object.WriteElement("duration", JSON::WriteInteger, (int)stats.duration);
  object.WriteElement("fraction", JSON::WriteFixed, stats.fraction);
  object.WriteElement("distance", JSON::WriteInteger, (int)stats.distance);
  object.WriteElement("speed", JSON::WriteFixed, stats.GetSpeed());
  object.WriteElement("vario", JSON::WriteFixed, stats.GetVario());
  object.WriteElement("glide_rate", JSON::WriteFixed, stats.GetGlideRate());
  object.WriteElement("count", JSON::WriteInteger, stats.merges);
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:13,代码来源:FlightPhaseJSON.cpp

示例5: call

void WriteRestartFile::call(size_t timestep)
{
  Phase *phase = M_PHASE;

  m_step++;

  if (m_step == m_write_every) {
    MSG_DEBUG("WriteRestartFile::call", "Outputting restart file.");

    phase->writeRestartFile(make_filename(m_file_name, m_file_no));
    
    m_file_no++;
    m_step = 0;
  }
}
开发者ID:argreiner,项目名称:sympler,代码行数:15,代码来源:write_restart_file.cpp

示例6: installElements

void installElements(Phase& th, const XML_Node& phaseNode)
{
    // get the declared element names
    if (!phaseNode.hasChild("elementArray")) {
        throw CanteraError("installElements",
                           "phase XML node doesn't have \"elementArray\" XML Node");
    }
    XML_Node& elements = phaseNode.child("elementArray");
    vector<string> enames;
    getStringArray(elements, enames);

    // // element database defaults to elements.xml
    string element_database = "elements.xml";
    if (elements.hasAttrib("datasrc")) {
        element_database = elements["datasrc"];
    }

    XML_Node* doc = get_XML_File(element_database);
    XML_Node* dbe = &doc->child("elementData");

    XML_Node& root = phaseNode.root();
    XML_Node* local_db = 0;
    if (root.hasChild("elementData")) {
        local_db = &root.child("elementData");
    }

    for (size_t i = 0; i < enames.size(); i++) {
        // Find the element data
        XML_Node* e = 0;
        if (local_db) {
            e = local_db->findByAttr("name",enames[i]);
        }
        if (!e) {
            e = dbe->findByAttr("name",enames[i]);
        }
        if (!e) {
            throw CanteraError("addElementsFromXML","no data for element "
                               +enames[i]);
        }

        // Add the element
        doublereal weight = 0.0;
        if (e->hasAttrib("atomicWt")) {
            weight = fpValue(e->attrib("atomicWt"));
        }
        int anum = 0;
        if (e->hasAttrib("atomicNumber")) {
            anum = intValue(e->attrib("atomicNumber"));
        }
        string symbol = e->attrib("name");
        doublereal entropy298 = ENTROPY298_UNKNOWN;
        if (e->hasChild("entropy298")) {
            XML_Node& e298Node = e->child("entropy298");
            if (e298Node.hasAttrib("value")) {
                entropy298 = fpValueCheck(e298Node["value"]);
            }
        }
        th.addElement(symbol, weight, anum, entropy298);
    }
}
开发者ID:arghdos,项目名称:cantera,代码行数:60,代码来源:ThermoFactory.cpp

示例7: WriteCirclingStats

static void
WriteCirclingStats(TextWriter &writer, const Phase &stats)
{
  JSON::ObjectWriter object(writer);
  object.WriteElement("alt_diff", JSON::WriteInteger, (int)stats.alt_diff);
  object.WriteElement("duration", JSON::WriteInteger, (int)stats.duration);
  object.WriteElement("fraction", JSON::WriteFixed, stats.fraction);
  object.WriteElement("vario", JSON::WriteFixed, stats.GetVario());
  object.WriteElement("count", JSON::WriteInteger, stats.merges);
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:10,代码来源:FlightPhaseJSON.cpp

示例8: WritePhase

static void
WritePhase(TextWriter &writer, Phase &phase)
{
  JSON::ObjectWriter object(writer);
  NarrowString<64> buffer;

  FormatISO8601(buffer.buffer(), phase.start_datetime);
  object.WriteElement("start_time", JSON::WriteString, buffer);

  FormatISO8601(buffer.buffer(), phase.end_datetime);
  object.WriteElement("end_time", JSON::WriteString, buffer);

  object.WriteElement("type", JSON::WriteString,
                      FormatPhaseType(phase.phase_type));
  object.WriteElement("duration", JSON::WriteInteger, (int)phase.duration);
  object.WriteElement("circling_direction", JSON::WriteString,
                      FormatCirclingDirection(phase.circling_direction));
  object.WriteElement("alt_diff", JSON::WriteInteger, (int)phase.alt_diff);
  object.WriteElement("distance", JSON::WriteInteger, (int)phase.distance);
  object.WriteElement("speed", JSON::WriteFixed, phase.GetSpeed());
  object.WriteElement("vario", JSON::WriteFixed, phase.GetVario());
  object.WriteElement("glide_rate", JSON::WriteFixed, phase.GetGlideRate());
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:23,代码来源:FlightPhaseJSON.cpp

示例9: computeForces

void FParticleVectorMatrix::computeForces(Particle* part, int force_index)
{
  Phase *phase = ((Simulation *) m_parent)->phase();
  
  size_t nOfParts = phase->returnNofPartC(m_colour);

  ParticleList& particles = phase->particles(m_colour);

  // slow (constant for this call) particle-row-index
  size_t p1 = part->mySlot;

  size_t p1Contrib = p1*SPACE_DIMS*nOfParts*SPACE_DIMS;

  // the force to be modified
  point_t force = {0,0,0};

  // outer (slow) cartesian loop
  for(size_t d1 = 0; d1 < SPACE_DIMS; ++d1) {
    size_t d1Contrib = d1*SPACE_DIMS*nOfParts;
    // inner (fast) particle loop
    for(size_t p2 = 0; p2 < nOfParts; ++p2) {
      point_t& vec = particles[p2].tag.pointByOffset(m_invec_offset);
      // inner (fast) cartesian loop
      for(size_t d2 = 0; d2 < SPACE_DIMS; ++d2) {
	size_t slot = d2
	  + p2*SPACE_DIMS
	  + d1Contrib
	  + p1Contrib;
	  force[d1] += -m_mat[slot]*vec[d2];
      }}}

  part->tag.pointByOffset(m_force_offset[force_index]) += force*m_factor;

//MSG_DEBUG("FParticleVectorMatrix::computeForces", "force AFTER = " << part->tag.tensorByOffset(m_force_offset[force_index]));

}
开发者ID:hemanth1947,项目名称:sympler,代码行数:36,代码来源:f_particle_vector_matrix.cpp

示例10: Error

void dsp::Archiver::set (Pulsar::Archive* archive, const PhaseSeries* phase)
try
{
  if (verbose > 2)
    cerr << "dsp::Archiver::set Pulsar::Archive" << endl;

  if (!archive)
    throw Error (InvalidParam, "dsp::Archiver::set Pulsar::Archive",
        	 "no Archive");

  if (!phase)
    throw Error (InvalidParam, "dsp::Archiver::set Pulsar::Archive",
        	 "no PhaseSeries");

  const unsigned npol  = get_npol (phase);
  const unsigned nchan = phase->get_nchan();
  const unsigned nbin  = phase->get_nbin();
  const unsigned nsub  = 1;

  if (verbose > 2)
    cerr << "dsp::Archiver::set Pulsar::Archive nsub=" << nsub 
         << " npol=" << npol << " nchan=" << nchan 
         << " nbin=" << nbin << " fourth=" << fourth_moments << endl;

  archive-> resize (nsub, npol, nchan, nbin);

  Pulsar::FITSHdrExtension* ext;
  ext = archive->get<Pulsar::FITSHdrExtension>();
  
  if (ext)
  {
    if (verbose > 2)
      cerr << "dsp::Archiver::set Pulsar::Archive FITSHdrExtension" << endl;

    // Make sure the start time is aligned with pulse phase zero
    // as this is what the PSRFITS format expects.

    MJD initial = phase->get_start_time();

    if (phase->has_folding_predictor())
    {
      Phase inphs = phase->get_folding_predictor()->phase(initial);
      double dtime = inphs.fracturns() * phase->get_folding_period();
      initial -= dtime;
    }

    ext->set_start_time (initial);

    // In keeping with tradition, I'll set this to a value that should
    // work in most places for the next 50 years or so ;)

    ext->set_coordmode("J2000");

    // Set the ASCII date stamp from the system clock (in UTC)

    time_t thetime;
    time(&thetime);
    string time_str = asctime(gmtime(&thetime));

    // Cut off the line feed character
    time_str = time_str.substr(0,time_str.length() - 1);

    ext->set_date_str(time_str);
  }

  archive-> set_telescope ( phase->get_telescope() );
  archive-> set_type ( phase->get_type() );

  switch (phase->get_state())
  {
  case Signal::NthPower:
  case Signal::PP_State:
  case Signal::QQ_State:
    archive->set_state (Signal::Intensity);
    break;
  
  case Signal::FourthMoment:
    archive->set_state (Signal::Stokes);
    break;

  default:
    archive-> set_state ( phase->get_state() );
  }

  archive-> set_scale ( Signal::FluxDensity );

  if (verbose > 2)
    cerr << "dsp::Archiver::set Archive source=" << phase->get_source()
         << "\n  coord=" << phase->get_coordinates()
         << "\n  bw=" << phase->get_bandwidth()
         << "\n  freq=" << phase->get_centre_frequency () << endl;

  archive-> set_source ( phase->get_source() );
  archive-> set_coordinates ( phase->get_coordinates() );
  archive-> set_bandwidth ( phase->get_bandwidth() );
  archive-> set_centre_frequency ( phase->get_centre_frequency() );
  archive-> set_dispersion_measure ( phase->get_dispersion_measure() );

  archive-> set_dedispersed( archive_dedispersed );
  archive-> set_faraday_corrected (false);
//.........这里部分代码省略.........
开发者ID:vincentvillani,项目名称:DSPSR,代码行数:101,代码来源:Archiver.C

示例11: TreeNames

std::vector<std::string> Base::TreeNames(Phase const& phase) const
{
    INFO0;
    return TreeNames(phase.Tag());
}
开发者ID:BoostedColliderAnalysis,项目名称:BoCA,代码行数:5,代码来源:Base.cpp

示例12: calculateRelativeVelocity

void Interaction::calculateRelativeVelocity(const Phase &x) {
	relativeVelocity = x.getBodyVelocity(moon);
	relativeVelocity -= x.getBodyVelocity(earth);
}
开发者ID:loczaj,项目名称:simulbody,代码行数:4,代码来源:interaction.cpp

示例13: int

float WalkingEngineKick::getValue(Track track, float externValue)
{
  std::vector<Phase>& phases = tracks[track];
  const int phasesSize = int(phases.size());
  int currentPhase = currentPhases[track];

  const bool init = currentPhase < 0;
  if(init)
    currentPhase = currentPhases[track] = 0;

  ASSERT(currentPhase < phasesSize - 1);
  Phase* phase = &phases[currentPhase];
  Phase* nextPhase = &phases[currentPhase + 1];

  if(init)
  {
    const bool precomputedLength = length >= 0.f;
    if(!precomputedLength)
    {
      phase->evaluateLength(0.f);
      nextPhase->evaluateLength(phase->end);
    }
    phase->evaluatePos(externValue);
    nextPhase->evaluatePos(externValue);
    Phase* const nextNextPhase = currentPhase + 2 < phasesSize ? &phases[currentPhase + 2] : 0;
    if(nextNextPhase)
    {
      if(!precomputedLength)
        nextNextPhase->evaluateLength(nextPhase->end);
      nextNextPhase->evaluatePos(externValue);
      nextPhase->velocity = ((nextPhase->pos - phase->pos) / phase->length + (nextNextPhase->pos - nextPhase->pos) / nextPhase->length) * 0.5f;
    }
  }

  while(phase->end <= currentPosition)
  {
    Phase* nextNextPhase = currentPhase + 2 < phasesSize ? &phases[currentPhase + 2] : 0;
    if(!nextNextPhase)
    {
      ASSERT(nextPhase->posValue == 0);
      return externValue;
    }

    currentPhase = ++currentPhases[track];
    phase = nextPhase;
    nextPhase = nextNextPhase;
    if(currentPhase + 2 < phasesSize)
    {
      nextNextPhase = &phases[currentPhase + 2];
      const bool precomputedLength = length >= 0.f;
      if(!precomputedLength)
        nextNextPhase->evaluateLength(nextPhase->end);
      nextNextPhase->evaluatePos(externValue);
      nextPhase->velocity = ((nextPhase->pos - phase->pos) / phase->length + (nextNextPhase->pos - nextPhase->pos) / nextPhase->length) * 0.5f;
    }
  }

  if(!phase->posValue)
    phase->pos = externValue;
  if(!nextPhase->posValue)
    nextPhase->pos = externValue;

  const float nextRatio = (currentPosition - phase->start) / phase->length;
  const float d = phase->pos;
  const float c = phase->velocity;
  const float v2 = nextPhase->velocity;
  const float p2 = nextPhase->pos;
  const float p2mcmd = p2 - c - d;
  const float a = -2.f * p2mcmd + (v2 - c);
  const float b = p2mcmd - a;
  const float x = nextRatio;
  const float xx = x * x;
  return a * xx * x + b * xx + c * x + d;
}
开发者ID:MisterSquishy,项目名称:nbites,代码行数:74,代码来源:WalkingEngineKick.cpp

示例14: ExportFileName

std::string Base::ExportFileName(Phase const& phase) const
{
    INFO0;
    return ExportFileName(phase.Stage(), phase.Tag());
}
开发者ID:BoostedColliderAnalysis,项目名称:BoCA,代码行数:5,代码来源:Base.cpp

示例15: double_cast

double double_cast (const Phase& phase)
{
  return phase.in_turns();
}
开发者ID:SkyTian13,项目名称:psrchive,代码行数:4,代码来源:Contemporaneity.C


注:本文中的Phase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。