Lines Matching refs:spanstats
18 PetscErrorCode SpanStatsCtxDestroy(SpanStatsCtx *spanstats) { in SpanStatsCtxDestroy() argument
19 SpanStatsCtx spanstats_ = *spanstats; in SpanStatsCtxDestroy()
35 *spanstats = NULL; in SpanStatsCtxDestroy()
39 static PetscErrorCode SpanwiseStatisticssCreateDM(Honee honee, SpanStatsCtx spanstats, PetscInt deg… in SpanwiseStatisticssCreateDM() argument
49 spanstats->num_comp_stats = num_comps; in SpanwiseStatisticssCreateDM()
53 spanstats->span_width = domain_max[2] - domain_min[2]; in SpanwiseStatisticssCreateDM()
70 …intf(isoperiodicface_key, sizeof isoperiodicface_key, "-%sisoperiodic_facesf", spanstats->prefix)); in SpanwiseStatisticssCreateDM()
86 …abel, 1, PETSC_FALSE, PETSC_FALSE, PetscObjectComm((PetscObject)honee->dm), NULL, &spanstats->dm)); in SpanwiseStatisticssCreateDM()
87 …PetscCall(DMSetCoordinateDisc(spanstats->dm, NULL, PETSC_FALSE, PETSC_TRUE)); // Ensure that a co… in SpanwiseStatisticssCreateDM()
89 PetscCall(DMPlexDistribute(spanstats->dm, 0, NULL, &parent_distributed_dm)); in SpanwiseStatisticssCreateDM()
92 PetscCall(DMDestroy(&spanstats->dm)); in SpanwiseStatisticssCreateDM()
93 spanstats->dm = parent_distributed_dm; in SpanwiseStatisticssCreateDM()
100 PetscCall(DMPlexIsSimplex(spanstats->dm, &is_simplex)); in SpanwiseStatisticssCreateDM()
104 PetscCall(PetscObjectSetName((PetscObject)spanstats->dm, "Spanwise_Stats")); in SpanwiseStatisticssCreateDM()
105 PetscCall(DMSetOptionsPrefix(spanstats->dm, spanstats->prefix)); in SpanwiseStatisticssCreateDM()
106 PetscCall(DMSetFromOptions(spanstats->dm)); in SpanwiseStatisticssCreateDM()
107 PetscCall(DMViewFromOptions(spanstats->dm, NULL, "-dm_view")); in SpanwiseStatisticssCreateDM()
110 …RUE, PETSC_TRUE, honee->app_ctx->degree, 1, honee->app_ctx->q_extra, 1, &spanstats->num_comp_stats, in SpanwiseStatisticssCreateDM()
111 spanstats->dm)); in SpanwiseStatisticssCreateDM()
177 static PetscErrorCode SpanwiseStatisticsSetupDataCreate(Honee honee, SpanStatsCtx spanstats, SpanSt… in SpanwiseStatisticsSetupDataCreate() argument
179 DM dm = spanstats->dm; in SpanwiseStatisticsSetupDataCreate()
181 CeedInt num_comp_x, num_comp_stats = spanstats->num_comp_stats; in SpanwiseStatisticsSetupDataCreate()
238 static PetscErrorCode SpanwiseStatisticsCreateSF(Honee honee, SpanStatsCtx spanstats, SpanStatsSetu… in SpanwiseStatisticsCreateSF() argument
280 …PetscCall(PetscSNPrintf(spanstats_sf_key, sizeof spanstats_sf_key, "-%ssf_view", spanstats->prefix… in SpanwiseStatisticsCreateSF()
281 PetscCall(PetscObjectSetName((PetscObject)*statssf, spanstats->prefix)); in SpanwiseStatisticsCreateSF()
291 static PetscErrorCode SpanwiseStatisticsSetupL2Projection(Honee honee, SpanStatsCtx spanstats, Span… in SpanwiseStatisticsSetupL2Projection() argument
295 CeedInt q_data_size, num_comp_stats = spanstats->num_comp_stats; in SpanwiseStatisticsSetupL2Projection()
310 …etscCall(OperatorApplyContextCreate(NULL, spanstats->dm, ceed, op_proj_rhs, NULL, NULL, NULL, NULL… in SpanwiseStatisticsSetupL2Projection()
311 …edOperatorCreateLocalVecs(op_proj_rhs, DMReturnVecType(spanstats->dm), PETSC_COMM_SELF, &spanstats… in SpanwiseStatisticsSetupL2Projection()
312 …PetscCall(QDataGet(ceed, spanstats->dm, DMLABEL_DEFAULT, DMLABEL_DEFAULT_VALUE, &elem_restr_qd, &q… in SpanwiseStatisticsSetupL2Projection()
327 PetscCall(MatCreateCeed(spanstats->dm, spanstats->dm, op_mass, NULL, &mat_mass)); in SpanwiseStatisticsSetupL2Projection()
329 PetscCall(KSPCreate(PetscObjectComm((PetscObject)spanstats->dm), &ksp)); in SpanwiseStatisticsSetupL2Projection()
330 PetscCall(KSPSetOptionsPrefix(ksp, spanstats->prefix)); in SpanwiseStatisticsSetupL2Projection()
341 spanstats->ksp = ksp; in SpanwiseStatisticsSetupL2Projection()
355 … SpanStatsSetupData *stats_setup_data, SpanStatsCtx *spanstats) { in SpanwiseStatisticsSetupInitialize() argument
379 *spanstats = spanstats_; in SpanwiseStatisticsSetupInitialize()
383 PetscErrorCode SpanwiseStatisticsSetupFinalize(TS ts, Honee honee, SpanStatsCtx spanstats, PetscVie… in SpanwiseStatisticsSetupFinalize() argument
387 PetscCall(SpanwiseStatisticsSetupL2Projection(honee, spanstats, *stats_setup_data)); in SpanwiseStatisticsSetupFinalize()
389 PetscCall(PetscViewerSetOptionsPrefix(ctx->viewer, spanstats->prefix)); in SpanwiseStatisticsSetupFinalize()
392 PetscCall(TSGetTime(ts, &spanstats->initial_solution_time)); in SpanwiseStatisticsSetupFinalize()
393 PetscCall(TSGetStepNumber(ts, &spanstats->initial_solution_step)); in SpanwiseStatisticsSetupFinalize()
394 CeedScalar initial_solution_time = spanstats->initial_solution_time; // done for type conversion in SpanwiseStatisticsSetupFinalize()
396 …CeedOperatorSetContextDouble(spanstats->op_stats_collect_ctx->op, spanstats->previous_time_label, … in SpanwiseStatisticsSetupFinalize()
404 PetscErrorCode SpanwiseStatisticsCollect(Honee honee, SpanStatsCtx spanstats, PetscScalar solution_… in SpanwiseStatisticsCollect() argument
412 …scCallCeed(honee->ceed, CeedOperatorSetContextDouble(spanstats->op_stats_collect_ctx->op, spanstat… in SpanwiseStatisticsCollect()
414 …PetscCall(ApplyAddCeedOperatorLocalToLocal(honee->Q_loc, spanstats->Child_Stats_loc, spanstats->op… in SpanwiseStatisticsCollect()
416 …scCallCeed(honee->ceed, CeedOperatorSetContextDouble(spanstats->op_stats_collect_ctx->op, spanstat… in SpanwiseStatisticsCollect()
423 PetscErrorCode SpanwiseStatisticsProcess(Honee honee, SpanStatsCtx spanstats, Vec stats) { in SpanwiseStatisticsProcess() argument
435 PetscCall(VecZeroEntries(spanstats->Parent_Stats_loc)); in SpanwiseStatisticsProcess()
437 PetscCall(VecGetArrayRead(spanstats->Child_Stats_loc, &child_stats)); in SpanwiseStatisticsProcess()
438 PetscCall(VecGetArray(spanstats->Parent_Stats_loc, &parent_stats)); in SpanwiseStatisticsProcess()
440 if (spanstats->num_comp_stats == 1) unit = MPIU_REAL; in SpanwiseStatisticsProcess()
442 PetscCallMPI(MPI_Type_contiguous(spanstats->num_comp_stats, MPIU_REAL, &unit)); in SpanwiseStatisticsProcess()
446 PetscCall(PetscSFReduceBegin(spanstats->sf, unit, child_stats, parent_stats, MPI_SUM)); in SpanwiseStatisticsProcess()
447 PetscCall(PetscSFReduceEnd(spanstats->sf, unit, child_stats, parent_stats, MPI_SUM)); in SpanwiseStatisticsProcess()
449 PetscCall(VecRestoreArrayRead(spanstats->Child_Stats_loc, &child_stats)); in SpanwiseStatisticsProcess()
450 PetscCall(VecRestoreArray(spanstats->Parent_Stats_loc, &parent_stats)); in SpanwiseStatisticsProcess()
454 PetscCall(DMGetOutputSequenceNumber(spanstats->dm, NULL, &solution_time)); in SpanwiseStatisticsProcess()
456 PetscCall(VecScale(spanstats->Parent_Stats_loc, 1 / (summing_duration * spanstats->span_width))); in SpanwiseStatisticsProcess()
459 PetscCall(DMGetGlobalVector(spanstats->dm, &RHS)); in SpanwiseStatisticsProcess()
460 …PetscCall(ApplyCeedOperatorLocalToGlobal(spanstats->Parent_Stats_loc, RHS, spanstats->op_proj_rhs_… in SpanwiseStatisticsProcess()
462 PetscCall(KSPSolve(spanstats->ksp, RHS, stats)); in SpanwiseStatisticsProcess()
464 PetscCall(DMRestoreGlobalVector(spanstats->dm, &RHS)); in SpanwiseStatisticsProcess()