• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TimeRange类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: isInRange_cc

bool Rythmos::isInRange_cc(const TimeRange<TimeType> &tr, const TimeType &p)
{
  return (
    compareTimeValues(p,tr.lower()) >= 0
    && compareTimeValues(p,tr.upper()) <= 0
    );
}
开发者ID:gitter-badger,项目名称:quinoa,代码行数:7,代码来源:Rythmos_TimeRange_def.hpp


示例2: TEUCHOS_UNIT_TEST

TEUCHOS_UNIT_TEST( Rythmos_TimeRange, copyAndScaleInvalid ) {
  TimeRange<double> tr;
  TimeRange<double> newTr = tr.copyAndScale(5.0);
  TEST_EQUALITY_CONST( newTr.isValid(), false );
  TEST_EQUALITY( newTr.lower(), tr.lower() );
  TEST_EQUALITY( newTr.upper(), tr.upper() );
  TEST_EQUALITY( newTr.length(), tr.length() );
}
开发者ID:haripandey,项目名称:trilinos,代码行数:8,代码来源:Rythmos_TimeRange_UnitTest.cpp


示例3: translateTimeRange

Scalar translateTimeRange(
    Scalar t,
    const TimeRange<Scalar>& sourceRange,
    const TimeRange<Scalar>& destinationRange
    ) {
  Scalar r = destinationRange.length()/sourceRange.length();
  return r*t+destinationRange.lower()-r*sourceRange.lower();
}
开发者ID:00liujj,项目名称:trilinos,代码行数:8,代码来源:Rythmos_QuadratureBase.hpp


示例4: ostab

void ImplicitBDFStepperRampingStepControl<Scalar>::initialize(
  const StepperBase<Scalar>& stepper)
{
  // Initialize can be called from the stepper when setInitialCondition
  // is called.
  using Teuchos::as;
  typedef Teuchos::ScalarTraits<Scalar> ST;
  using Thyra::createMember;

  // Set initial time:
  TimeRange<Scalar> stepperRange = stepper.getTimeRange();
  TEUCHOS_TEST_FOR_EXCEPTION(
      !stepperRange.isValid(),
      std::logic_error,
      "Error, Stepper does not have valid time range for initialization "
      "of ImplicitBDFStepperRampingStepControl!\n");

  if (is_null(parameterList_)) {
    RCP<Teuchos::ParameterList> emptyParameterList =
      Teuchos::rcp(new Teuchos::ParameterList);
    this->setParameterList(emptyParameterList);
  }

  if (is_null(errWtVecCalc_)) {
    RCP<ImplicitBDFStepperErrWtVecCalc<Scalar> > IBDFErrWtVecCalc =
      rcp(new ImplicitBDFStepperErrWtVecCalc<Scalar>());
    errWtVecCalc_ = IBDFErrWtVecCalc;
  }

  stepControlState_ = UNINITIALIZED;

  requestedStepSize_ = Scalar(-1.0);
  currentStepSize_ = initialStepSize_;
  currentOrder_ = 1;
  nextStepSize_ = initialStepSize_;
  nextOrder_ = 1;
  numberOfSteps_ = 0;
  totalNumberOfFailedSteps_ = 0;
  countOfConstantStepsAfterFailure_ = 0;

  if (is_null(delta_)) {
    delta_ = createMember(stepper.get_x_space());
  }
  if (is_null(errWtVec_)) {
    errWtVec_ = createMember(stepper.get_x_space());
  }
  V_S(delta_.ptr(),ST::zero());

  if ( doOutput_(Teuchos::VERB_HIGH) ) {
    RCP<Teuchos::FancyOStream> out = this->getOStream();
    Teuchos::OSTab ostab(out,1,"initialize");
    *out << "currentOrder_ = " << currentOrder_ << std::endl;
    *out << "numberOfSteps_ = " << numberOfSteps_ << std::endl;
  }

  setStepControlState_(BEFORE_FIRST_STEP);

}
开发者ID:gitter-badger,项目名称:quinoa,代码行数:58,代码来源:Rythmos_ImplicitBDFStepperRampingStepControl_def.hpp


示例5: GetMarkers

void AudioMarkerProviderKeyframes::GetMarkers(TimeRange const& range, AudioMarkerVector &out) const {
	// Find first and last keyframes inside the range
	auto a = lower_bound(markers.begin(), markers.end(), range.begin());
	auto b = upper_bound(markers.begin(), markers.end(), range.end());

	// Place pointers to the markers in the output vector
	for (; a != b; ++a)
		out.push_back(&*a);
}
开发者ID:KagamiChan,项目名称:Aegisub,代码行数:9,代码来源:audio_marker.cpp


示例6: PlayRange

void AudioController::PlayRange(const TimeRange &range)
{
	if (!IsAudioOpen()) return;

	player->Play(SamplesFromMilliseconds(range.begin()), SamplesFromMilliseconds(range.length()));
	playback_mode = PM_Range;
	playback_timer.Start(20);

	AnnouncePlaybackPosition(range.begin());
}
开发者ID:sthenc,项目名称:Aegisub,代码行数:10,代码来源:audio_controller.cpp


示例7: if

string GenlistItemScenarioSchedule::getLabelItem(Evas_Object *obj, string part)
{
    string text;

    if (!scenario) return text;

    if (part == "text")
    {
        text = scenario->ioScenario->params["name"];
    }
    else if (part == "time")
    {
        text = "N/A";

        if (scenario->isScheduled())
        {
            auto getTimeForDate = [=,&text](vector<TimeRange> &range)
            {
                if (scheduleRangeNum >= 0 && scheduleRangeNum < range.size())
                {
                    TimeRange tr = range[scheduleRangeNum];
                    text = tr.getStartTimeSec(scDate.tm_year + 1900, scDate.tm_mon + 1, scDate.tm_mday);
                }
            };

            switch (scheduleRange)
            {
            case TimeRange::MONDAY: getTimeForDate(scenario->ioSchedule->range_infos.range_monday); break;
            case TimeRange::TUESDAY: getTimeForDate(scenario->ioSchedule->range_infos.range_tuesday); break;
            case TimeRange::WEDNESDAY: getTimeForDate(scenario->ioSchedule->range_infos.range_wednesday); break;
            case TimeRange::THURSDAY: getTimeForDate(scenario->ioSchedule->range_infos.range_thursday); break;
            case TimeRange::FRIDAY: getTimeForDate(scenario->ioSchedule->range_infos.range_friday); break;
            case TimeRange::SATURDAY: getTimeForDate(scenario->ioSchedule->range_infos.range_saturday); break;
            case TimeRange::SUNDAY: getTimeForDate(scenario->ioSchedule->range_infos.range_sunday); break;
            default: break;
            }
        }
    }
    else if (part == "actions.text")
    {
        text = "Aucune actions.";
        if (scenario->scenario_data.steps.size() > 1)
            text = Utils::to_string(scenario->scenario_data.steps.size()) + " étapes.";
        else if (scenario->scenario_data.steps.size() == 1 &&
                 scenario->scenario_data.steps[0].actions.size() > 0)
            text = Utils::to_string(scenario->scenario_data.steps[0].actions.size()) + " actions.";
    }

    if (scenario->scenario_data.params["schedule"] != "false")
        itemEmitSignal("schedule,true", "calaos");
    else
        itemEmitSignal("schedule,false", "calaos");

    return text;
}
开发者ID:JulienMasson,项目名称:calaos_base,代码行数:55,代码来源:GenlistItemScenarioSchedule.cpp


示例8: GetMarkers

void AudioTimingControllerKaraoke::GetMarkers(TimeRange const& range, AudioMarkerVector &out) const {
	size_t i;
	for (i = 0; i < markers.size() && markers[i] < range.begin(); ++i) ;
	for (; i < markers.size() && markers[i] < range.end(); ++i)
		out.push_back(&markers[i]);

	if (range.contains(start_marker)) out.push_back(&start_marker);
	if (range.contains(end_marker)) out.push_back(&end_marker);

	keyframes_provider.GetMarkers(range, out);
	video_position_provider.GetMarkers(range, out);
}
开发者ID:Gpower2,项目名称:Aegisub,代码行数:12,代码来源:audio_timing_karaoke.cpp


示例9: GetMarkers

void SecondsMarkerProvider::GetMarkers(TimeRange const& range, AudioMarkerVector &out) const {
	if (!enabled->GetBool()) return;

	if ((range.length() + 999) / 1000 > (int)markers.size())
		markers.resize((range.length() + 999) / 1000, Marker(pen.get()));

	size_t i = 0;
	for (int time = ((range.begin() + 999) / 1000) * 1000; time < range.end(); time += 1000) {
		markers[i].position = time;
		out.push_back(&markers[i++]);
	}
}
开发者ID:Gpower2,项目名称:Aegisub,代码行数:12,代码来源:audio_marker.cpp


示例10: asssertInTimeRange

void Rythmos::asssertInTimeRange( const TimeRange<TimeType> &timeRange,
  const TimeType &time )
{
  TEUCHOS_TEST_FOR_EXCEPTION( !timeRange.isInRange(time), std::out_of_range,
    "Error, the time = " << time
    << " is out of the range = " << timeRange << "!"
    );
}
开发者ID:gitter-badger,项目名称:quinoa,代码行数:8,代码来源:Rythmos_TimeRange_def.hpp


示例11: TEST_FOR_EXCEPTION

void Rythmos::assertNoTimePointsInsideCurrentTimeRange(
  const InterpolationBufferBase<Scalar>& interpBuffer,
  const Array<Scalar>& time_vec
  )
{
  typedef ScalarTraits<Scalar> ST;
  const int numTimePoints = time_vec.size();
  const TimeRange<Scalar> currentTimeRange = interpBuffer.getTimeRange();
  if (currentTimeRange.length() >= ST::zero()) {
    for ( int i = 0; i < numTimePoints; ++i ) {
      TEST_FOR_EXCEPTION(
        currentTimeRange.isInRange(time_vec[i]), std::out_of_range,
        "Error, time_vec["<<i<<"] = " << time_vec[i] << " is in TimeRange of " 
        << interpBuffer.description() << " = ["
        << currentTimeRange.lower() << "," << currentTimeRange.upper() << "]!"
        );
    }
  }
}
开发者ID:haripandey,项目名称:trilinos,代码行数:19,代码来源:Rythmos_InterpolationBufferHelpers.hpp


示例12: PaintAudio

void AudioDisplay::PaintAudio(wxDC &dc, TimeRange updtime, wxRect updrect)
{
	auto pt = style_ranges.upper_bound(updtime.begin());
	auto pe = style_ranges.upper_bound(updtime.end());

	if (pt != style_ranges.begin())
		--pt;

	while (pt != pe)
	{
		AudioRenderingStyle range_style = static_cast<AudioRenderingStyle>(pt->second);
		int range_x1 = std::max(updrect.x, RelativeXFromTime(pt->first));
		int range_x2 = (++pt == pe) ? updrect.x + updrect.width : RelativeXFromTime(pt->first);

		if (range_x2 > range_x1)
		{
			audio_renderer->Render(dc, wxPoint(range_x1, audio_top), range_x1 + scroll_left, range_x2 - range_x1, range_style);
		}
	}
}
开发者ID:Gpower2,项目名称:Aegisub,代码行数:20,代码来源:audio_display.cpp


示例13: ScrollTimeRangeInView

void AudioDisplay::ScrollTimeRangeInView(const TimeRange &range)
{
	int client_width = GetClientRect().GetWidth();
	int range_begin = AbsoluteXFromTime(range.begin());
	int range_end = AbsoluteXFromTime(range.end());
	int range_len = range_end - range_begin;

	// Remove 5 % from each side of the client area.
	int leftadjust = client_width / 20;
	int client_left = scroll_left + leftadjust;
	client_width = client_width * 9 / 10;

	// Is everything already in view?
	if (range_begin >= client_left && range_end <= client_left+client_width)
		return;

	// The entire range can fit inside the view, center it
	if (range_len < client_width)
	{
		ScrollPixelToLeft(range_begin - (client_width-range_len)/2 - leftadjust);
	}

	// Range doesn't fit in view and we're viewing a middle part of it, just leave it alone
	else if (range_begin < client_left && range_end > client_left+client_width)
	{
		// nothing
	}

	// Right edge is in view, scroll it as far to the right as possible
	else if (range_end >= client_left && range_end < client_left+client_width)
	{
		ScrollPixelToLeft(range_end - client_width - leftadjust);
	}

	// Nothing is in view or the left edge is in view, scroll left edge as far to the left as possible
	else
	{
		ScrollPixelToLeft(range_begin - leftadjust);
	}
}
开发者ID:Gpower2,项目名称:Aegisub,代码行数:40,代码来源:audio_display.cpp


示例14: webRtcDetectVoiceActivity

JoiningBoundedTimeline<void> webRtcDetectVoiceActivity(const AudioClip& audioClip, ProgressSink& progressSink) {
    VadInst* vadHandle = WebRtcVad_Create();
    if (!vadHandle) throw runtime_error("Error creating WebRTC VAD handle.");

    auto freeHandle = gsl::finally([&]() {
        WebRtcVad_Free(vadHandle);
    });

    int error = WebRtcVad_Init(vadHandle);
    if (error) throw runtime_error("Error initializing WebRTC VAD handle.");

    const int aggressiveness = 2; // 0..3. The higher, the more is cut off.
    error = WebRtcVad_set_mode(vadHandle, aggressiveness);
    if (error) throw runtime_error("Error setting WebRTC VAD aggressiveness.");

    ProgressMerger progressMerger(progressSink);
    ProgressSink& pass1ProgressSink = progressMerger.addSink(1.0);
    ProgressSink& pass2ProgressSink = progressMerger.addSink(0.3);

    // Detect activity
    JoiningBoundedTimeline<void> activity(audioClip.getTruncatedRange());
    centiseconds time = 0_cs;
    const size_t bufferCapacity = audioClip.getSampleRate() / 100;
    auto processBuffer = [&](const vector<int16_t>& buffer) {
        // WebRTC is picky regarding buffer size
        if (buffer.size() < bufferCapacity) return;

        int result = WebRtcVad_Process(vadHandle, audioClip.getSampleRate(), buffer.data(), buffer.size()) == 1;
        if (result == -1) throw runtime_error("Error processing audio buffer using WebRTC VAD.");

        bool isActive = result != 0;
        if (isActive) {
            activity.set(time, time + 1_cs);
        }
        time += 1_cs;
    };
    process16bitAudioClip(audioClip, processBuffer, bufferCapacity, pass1ProgressSink);

    // WebRTC adapts to the audio. This means results may not be correct at the very beginning.
    // It sometimes returns false activity at the very beginning, mistaking the background noise for speech.
    // So we delete the first recognized utterance and re-process the corresponding audio segment.
    if (!activity.empty()) {
        TimeRange firstActivity = activity.begin()->getTimeRange();
        activity.clear(firstActivity);
        unique_ptr<AudioClip> streamStart = audioClip.clone() | segment(TimeRange(0_cs, firstActivity.getEnd()));
        time = 0_cs;
        process16bitAudioClip(*streamStart, processBuffer, bufferCapacity, pass2ProgressSink);
    }

    return activity;
}
开发者ID:DanielSWolf,项目名称:rhubarb-lip-sync,代码行数:51,代码来源:voiceActivityDetection.cpp


示例15: selectPointsInTimeRange

void Rythmos::selectPointsInTimeRange(
    const Array<TimeType>& points_in,
    const TimeRange<TimeType>& range,
    const Ptr<Array<TimeType> >& points_out 
    )
{
  points_out->clear();
  int Nt = Teuchos::as<int>(points_in.size());
  for (int i=0; i < Nt ; ++i) {
    if (range.isInRange(points_in[i])) {
      points_out->push_back(points_in[i]);
    }
  }
}
开发者ID:haripandey,项目名称:trilinos,代码行数:14,代码来源:Rythmos_InterpolationBufferHelpers.hpp


示例16: SaveClip

void AudioController::SaveClip(wxString const& filename, TimeRange const& range) const
{
	int64_t start_sample = SamplesFromMilliseconds(range.begin());
	int64_t end_sample = SamplesFromMilliseconds(range.end());
	if (filename.empty() || start_sample > provider->GetNumSamples() || range.length() == 0) return;

	agi::io::Save outfile(STD_STR(filename), true);
	std::ofstream& out(outfile.Get());

	size_t bytes_per_sample = provider->GetBytesPerSample() * provider->GetChannels();
	size_t bufsize = (end_sample - start_sample) * bytes_per_sample;

	int intval;
	short shortval;

	out << "RIFF";
	out.write((char*)&(intval=bufsize+36),4);
	out<< "WAVEfmt ";
	out.write((char*)&(intval=16),4);
	out.write((char*)&(shortval=1),2);
	out.write((char*)&(shortval=provider->GetChannels()),2);
	out.write((char*)&(intval=provider->GetSampleRate()),4);
	out.write((char*)&(intval=provider->GetSampleRate()*provider->GetChannels()*provider->GetBytesPerSample()),4);
	out.write((char*)&(intval=provider->GetChannels()*provider->GetBytesPerSample()),2);
	out.write((char*)&(shortval=provider->GetBytesPerSample()<<3),2);
	out << "data";
	out.write((char*)&bufsize,4);

	//samples per read
	size_t spr = 65536 / bytes_per_sample;
	std::vector<char> buf(bufsize);
	for(int64_t i = start_sample; i < end_sample; i += spr) {
		size_t len = std::min<size_t>(spr, end_sample - i);
		provider->GetAudio(&buf[0], i, len);
		out.write(&buf[0], len * bytes_per_sample);
	}
}
开发者ID:sthenc,项目名称:Aegisub,代码行数:37,代码来源:audio_controller.cpp


示例17:

void
PlayerSceneCreate::applyTransitionAnimation(SceneNodePtr start_node, SceneNodePtr end_node,
        const PlayerItemPtr item, const TimeRange &time_range,
        SceneNode *middle_node)
{
    Time beginTime = time_range.getVisibleStartTime();
    Time endTime = time_range.getVisibleEndTime();

    // TODO: check for whether the difference between begin and end time is enough for the
    // duration of the two transitions. Should have been checked by whoever set up the
    // the PlayerTimeline earlier.

    const TransitionPtr trans = item->getStartTransition();
    // Add in the animations based on the begin transition
    if (trans) {
        trans->addKeysForNextItem(start_node.get(), beginTime, beginTime + Time::Seconds(trans->getDuration()), middle_node);
    }

    const TransitionPtr endTrans = item->getEndTransition();
    // Add in the animations based on the end transition
    if (endTrans)  {
        endTrans->addKeysForPreviousItem(end_node.get(), endTime - Time::Seconds(endTrans->getDuration()), endTime, middle_node);
    }
}
开发者ID:CaringLabs,项目名称:MediaFramework,代码行数:24,代码来源:PlayerSceneCreate.cpp


示例18: removePointsInTimeRange

void Rythmos::removePointsInTimeRange(
    Array<TimeType>* points_in, 
    const TimeRange<TimeType>& range 
    )
{
  Array<TimeType> values_to_remove;
  for (int i=0 ; i<Teuchos::as<int>(points_in->size()) ; ++i) {
    if (range.isInRange((*points_in)[i])) {
      values_to_remove.push_back((*points_in)[i]);
    }
  }
  typename Array<TimeType>::iterator point_it;
  for (int i=0 ; i< Teuchos::as<int>(values_to_remove.size()) ; ++i) {
    point_it = std::find(points_in->begin(),points_in->end(),values_to_remove[i]);
    TEST_FOR_EXCEPTION(
        point_it == points_in->end(), std::logic_error,
        "Error, point to remove = " << values_to_remove[i] << " not found with std:find!\n"
        );
    points_in->erase(point_it);
  }
}
开发者ID:haripandey,项目名称:trilinos,代码行数:21,代码来源:Rythmos_InterpolationBufferHelpers.hpp


示例19: computeArea

RCP<Thyra::VectorBase<Scalar> > computeArea(
    const Thyra::ModelEvaluator<Scalar>& me, 
    const TimeRange<Scalar>& tr, 
    const GaussQuadrature1D<Scalar>& gq
    ) {
  typedef Teuchos::ScalarTraits<Scalar> ST;
  RCP<Thyra::VectorBase<Scalar> > area = Thyra::createMember(me.get_x_space());
  V_S(outArg(*area),ST::zero());
  RCP<const TimeRange<Scalar> > sourceRange = gq.getRange();
  RCP<const Array<Scalar> > sourcePts = gq.getPoints();
  RCP<const Array<Scalar> > sourceWts = gq.getWeights();
  Array<Scalar> destPts(*sourcePts);
  for (unsigned int i=0 ; i<sourcePts->size() ; ++i) {
    destPts[i] = translateTimeRange<Scalar>((*sourcePts)[i],*sourceRange,tr);
  }
  Scalar r = tr.length()/sourceRange->length();
  for (unsigned int i=0 ; i<destPts.size() ; ++i) {
    RCP<Thyra::VectorBase<Scalar> > tmpVec = eval_f_t<Scalar>(me,destPts[i]);
    Vp_StV(outArg(*area),r*(*sourceWts)[i],*tmpVec);
  }
  return area;
}
开发者ID:00liujj,项目名称:trilinos,代码行数:22,代码来源:Rythmos_QuadratureBase.hpp


示例20: TEUCHOS_UNIT_TEST

TEUCHOS_UNIT_TEST( BasicDiscreteAdjointStepperTester, rawNonlinearAdjoint )
{

  using Teuchos::outArg;
  using Teuchos::describe;
  using Teuchos::getParametersFromXmlString;
  typedef Thyra::ModelEvaluatorBase MEB;

  //
  out << "\nA) Create the nonlinear ME ...\n";
  //

  RCP<VanderPolModel> stateModel = vanderPolModel(
    getParametersFromXmlString(
      "<ParameterList>"
      "  <Parameter name=\"Implicit model formulation\" type=\"bool\" value=\"1\"/>"
      "</ParameterList>"
      )
    );

  //
  out << "\nB) Create the nonlinear solver ...\n";
  //

  RCP<TimeStepNonlinearSolver<double> > nlSolver = timeStepNonlinearSolver<double>(
    getParametersFromXmlString(
      "<ParameterList>"
      "  <Parameter name=\"Default Tol\" type=\"double\" value=\"1.0e-10\"/>"
      "  <Parameter name=\"Default Max Iters\" type=\"int\" value=\"20\"/>"
      "</ParameterList>"
      )
    );

  //
  out << "\nC) Create the integrator for the forward state problem ...\n";
  //

  RCP<IntegratorBuilder<double> > ib = integratorBuilder<double>(
    Teuchos::getParametersFromXmlString(
      "<ParameterList>"
      "  <ParameterList name=\"Stepper Settings\">"
      "    <ParameterList name=\"Stepper Selection\">"
      "      <Parameter name=\"Stepper Type\" type=\"string\" value=\"Backward Euler\"/>"
      "    </ParameterList>"
      "  </ParameterList>"
      "  <ParameterList name=\"Integration Control Strategy Selection\">"
      "    <Parameter name=\"Integration Control Strategy Type\" type=\"string\""
      "      value=\"Simple Integration Control Strategy\"/>"
      "    <ParameterList name=\"Simple Integration Control Strategy\">"
      "      <Parameter name=\"Take Variable Steps\" type=\"bool\" value=\"false\"/>"
      "      <Parameter name=\"Fixed dt\" type=\"double\" value=\"0.5\"/>" // Gives 2 time steps!
      "    </ParameterList>"
      "  </ParameterList>"
      "  <ParameterList name=\"Interpolation Buffer Settings\">"
      "    <ParameterList name=\"Trailing Interpolation Buffer Selection\">"
      "      <Parameter name=\"Interpolation Buffer Type\" type=\"string\" value=\"Interpolation Buffer\"/>"
      "    </ParameterList>"
      "  </ParameterList>"
      "</ParameterList>"
      )
    );
  
  MEB::InArgs<double> ic = stateModel->getNominalValues();
  RCP<IntegratorBase<double> > integrator = ib->create(stateModel, ic, nlSolver);
  //integrator->setVerbLevel(Teuchos::VERB_EXTREME);

  // ToDo: Set the trailing IB to pick up the entire state solution!

  // 
  out << "\nD) Solve the basic forward problem ...\n";
  //

  const TimeRange<double> fwdTimeRange = integrator->getFwdTimeRange();
  const double t_final = fwdTimeRange.upper();
  RCP<const Thyra::VectorBase<double> > x_final, x_dot_final;
  get_fwd_x_and_x_dot( *integrator, t_final, outArg(x_final), outArg(x_dot_final) );

  out << "\nt_final = " << t_final << "\n";
  out << "\nx_final: " << *x_final;
  out << "\nx_dot_final: " << *x_dot_final;

  //
  out << "\nE) Create the basic adjoint model (no distributed response) ...\n";
  //

  RCP<AdjointModelEvaluator<double> > adjModel =
    adjointModelEvaluator<double>(
      stateModel, fwdTimeRange
      );
  adjModel->setFwdStateSolutionBuffer(integrator);

  //
  out << "\nF) Create a stepper and integrator for the adjoint ...\n";
  //
  
  RCP<Thyra::LinearNonlinearSolver<double> > adjTimeStepSolver =
    Thyra::linearNonlinearSolver<double>();
  RCP<Rythmos::StepperBase<double> > adjStepper =
    integrator->getStepper()->cloneStepperAlgorithm();

//.........这里部分代码省略.........
开发者ID:00liujj,项目名称:trilinos,代码行数:101,代码来源:Rythmos_BasicDiscreteAdjointStepperTester_UnitTest.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TimeRanges类代码示例发布时间:2022-05-31
下一篇:
C++ TimePoint类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap