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


C++ IBTK_TIMER_STOP函数代码示例

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


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

示例1: VecMAXPY_SAMRAI

PetscErrorCode
VecMAXPY_SAMRAI(
    Vec y,
    PetscInt nv,
    const PetscScalar* alpha,
    Vec* x)
{
    IBTK_TIMER_START(t_vec_maxpy);
#ifdef DEBUG_CHECK_ASSERTIONS
    TBOX_ASSERT(y != PETSC_NULL);
    for (PetscInt i = 0; i < nv; ++i)
    {
        TBOX_ASSERT(x[i] != PETSC_NULL);
    }
#endif
    static const bool interior_only = false;
    for (PetscInt i = 0; i < nv; ++i)
    {
        if (MathUtilities<double>::equalEps(alpha[i],1.0))
        {
            PSVR_CAST2(y)->add(PSVR_CAST2(x[i]), PSVR_CAST2(y), interior_only);
        }
        else if (MathUtilities<double>::equalEps(alpha[i],-1.0))
        {
            PSVR_CAST2(y)->subtract(PSVR_CAST2(y), PSVR_CAST2(x[i]), interior_only);
        }
        else
        {
            PSVR_CAST2(y)->axpy(alpha[i], PSVR_CAST2(x[i]), PSVR_CAST2(y), interior_only);
        }
    }
    int ierr = PetscObjectStateIncrease(reinterpret_cast<PetscObject>(y)); IBTK_CHKERRQ(ierr);
    IBTK_TIMER_STOP(t_vec_maxpy);
    PetscFunctionReturn(0);
}// VecMAXPY
开发者ID:MSV-Project,项目名称:IBAMR,代码行数:35,代码来源:PETScSAMRAIVectorReal.C

示例2: VecNorm_local_SAMRAI

PetscErrorCode VecNorm_local_SAMRAI(Vec x, NormType type, PetscScalar* val)
{
    IBTK_TIMER_START(t_vec_norm_local);
#if !defined(NDEBUG)
    TBOX_ASSERT(x);
#endif
    static const bool local_only = true;
    if (type == NORM_1)
    {
        *val = NormOps::L1Norm(PSVR_CAST2(x), local_only);
    }
    else if (type == NORM_2)
    {
        *val = NormOps::L2Norm(PSVR_CAST2(x), local_only);
    }
    else if (type == NORM_INFINITY)
    {
        *val = NormOps::maxNorm(PSVR_CAST2(x), local_only);
    }
    else if (type == NORM_1_AND_2)
    {
        val[0] = NormOps::L1Norm(PSVR_CAST2(x), local_only);
        val[1] = NormOps::L2Norm(PSVR_CAST2(x), local_only);
    }
    else
    {
        TBOX_ERROR("PETScSAMRAIVectorReal::norm()\n"
                   << "  vector norm type " << static_cast<int>(type) << " unsupported"
                   << std::endl);
    }
    IBTK_TIMER_STOP(t_vec_norm_local);
    PetscFunctionReturn(0);
} // VecNorm_local
开发者ID:knepley,项目名称:IBAMR,代码行数:33,代码来源:PETScSAMRAIVectorReal.cpp

示例3: VecWAXPY_SAMRAI

PetscErrorCode
VecWAXPY_SAMRAI(
    Vec w,
    PetscScalar alpha,
    Vec x,
    Vec y)
{
    IBTK_TIMER_START(t_vec_waxpy);
#ifdef DEBUG_CHECK_ASSERTIONS
    TBOX_ASSERT(x != PETSC_NULL);
    TBOX_ASSERT(y != PETSC_NULL);
    TBOX_ASSERT(w != PETSC_NULL);
#endif
    static const bool interior_only = false;
    if (MathUtilities<double>::equalEps(alpha,1.0))
    {
        PSVR_CAST2(w)->add(PSVR_CAST2(x), PSVR_CAST2(y), interior_only);
    }
    else if (MathUtilities<double>::equalEps(alpha,-1.0))
    {
        PSVR_CAST2(w)->subtract(PSVR_CAST2(y), PSVR_CAST2(x), interior_only);
    }
    else
    {
        PSVR_CAST2(w)->axpy(alpha, PSVR_CAST2(x), PSVR_CAST2(y), interior_only);
    }
    int ierr = PetscObjectStateIncrease(reinterpret_cast<PetscObject>(w)); IBTK_CHKERRQ(ierr);
    IBTK_TIMER_STOP(t_vec_waxpy);
    PetscFunctionReturn(0);
}// VecWAXPY
开发者ID:MSV-Project,项目名称:IBAMR,代码行数:30,代码来源:PETScSAMRAIVectorReal.C

示例4: VecAYPX_SAMRAI

PetscErrorCode VecAYPX_SAMRAI(Vec y, const PetscScalar alpha, Vec x)
{
    IBTK_TIMER_START(t_vec_aypx);
#if !defined(NDEBUG)
    TBOX_ASSERT(x);
    TBOX_ASSERT(y);
#endif
    static const bool interior_only = false;
    if (MathUtilities<double>::equalEps(alpha, 1.0))
    {
        PSVR_CAST2(y)->add(PSVR_CAST2(x), PSVR_CAST2(y), interior_only);
    }
    else if (MathUtilities<double>::equalEps(alpha, -1.0))
    {
        PSVR_CAST2(y)->subtract(PSVR_CAST2(x), PSVR_CAST2(y), interior_only);
    }
    else
    {
        PSVR_CAST2(y)->axpy(alpha, PSVR_CAST2(y), PSVR_CAST2(x), interior_only);
    }
    int ierr = PetscObjectStateIncrease(reinterpret_cast<PetscObject>(y));
    IBTK_CHKERRQ(ierr);
    IBTK_TIMER_STOP(t_vec_aypx);
    PetscFunctionReturn(0);
} // VecAYPX
开发者ID:knepley,项目名称:IBAMR,代码行数:25,代码来源:PETScSAMRAIVectorReal.cpp

示例5: IBTK_TIMER_START

bool
PETScKrylovLinearSolver::solveSystem(SAMRAIVectorReal<NDIM, double>& x, SAMRAIVectorReal<NDIM, double>& b)
{
    IBTK_TIMER_START(t_solve_system);

#if !defined(NDEBUG)
    TBOX_ASSERT(d_A);
#endif
    int ierr;

    // Initialize the solver, when necessary.
    const bool deallocate_after_solve = !d_is_initialized;
    if (deallocate_after_solve) initializeSolverState(x, b);
#if !defined(NDEBUG)
    TBOX_ASSERT(d_petsc_ksp);
#endif
    resetKSPOptions();

    // Allocate scratch data.
    d_b->allocateVectorData();

    // Solve the system using a PETSc KSP object.
    d_b->copyVector(Pointer<SAMRAIVectorReal<NDIM, double> >(&b, false));
    d_A->setHomogeneousBc(d_homogeneous_bc);
    d_A->modifyRhsForBcs(*d_b);
    d_A->setHomogeneousBc(true);
    PETScSAMRAIVectorReal::replaceSAMRAIVector(d_petsc_x, Pointer<SAMRAIVectorReal<NDIM, double> >(&x, false));
    PETScSAMRAIVectorReal::replaceSAMRAIVector(d_petsc_b, d_b);
    ierr = KSPSolve(d_petsc_ksp, d_petsc_b, d_petsc_x);
    IBTK_CHKERRQ(ierr);
    d_A->setHomogeneousBc(d_homogeneous_bc);
    d_A->imposeSolBcs(x);

    // Get iterations count and residual norm.
    ierr = KSPGetIterationNumber(d_petsc_ksp, &d_current_iterations);
    IBTK_CHKERRQ(ierr);
    ierr = KSPGetResidualNorm(d_petsc_ksp, &d_current_residual_norm);
    IBTK_CHKERRQ(ierr);
    d_A->setHomogeneousBc(d_homogeneous_bc);

    // Determine the convergence reason.
    KSPConvergedReason reason;
    ierr = KSPGetConvergedReason(d_petsc_ksp, &reason);
    IBTK_CHKERRQ(ierr);
    const bool converged = (static_cast<int>(reason) > 0);
    if (d_enable_logging) reportKSPConvergedReason(reason, plog);

    // Dealocate scratch data.
    d_b->deallocateVectorData();

    // Deallocate the solver, when necessary.
    if (deallocate_after_solve) deallocateSolverState();

    IBTK_TIMER_STOP(t_solve_system);
    return converged;
} // solveSystem
开发者ID:walterjunjun,项目名称:IBAMR,代码行数:56,代码来源:PETScKrylovLinearSolver.cpp

示例6: VecGetLocalSize_SAMRAI

PetscErrorCode VecGetLocalSize_SAMRAI(Vec v, PetscInt* size)
{
    IBTK_TIMER_START(t_vec_get_local_size);
#if !defined(NDEBUG)
    TBOX_ASSERT(v);
#endif
    *size = v->map->n;
    IBTK_TIMER_STOP(t_vec_get_local_size);
    PetscFunctionReturn(0);
} // VecGetLocalSize
开发者ID:knepley,项目名称:IBAMR,代码行数:10,代码来源:PETScSAMRAIVectorReal.cpp

示例7: VecMin_SAMRAI

PetscErrorCode VecMin_SAMRAI(Vec x, PetscInt* p, PetscScalar* val)
{
    IBTK_TIMER_START(t_vec_min);
#if !defined(NDEBUG)
    TBOX_ASSERT(x);
#endif
    *p = -1;
    *val = PSVR_CAST2(x)->min();
    IBTK_TIMER_STOP(t_vec_min);
    PetscFunctionReturn(0);
} // VecMin
开发者ID:knepley,项目名称:IBAMR,代码行数:11,代码来源:PETScSAMRAIVectorReal.cpp

示例8: VecTDot_SAMRAI

PetscErrorCode VecTDot_SAMRAI(Vec x, Vec y, PetscScalar* val)
{
    IBTK_TIMER_START(t_vec_t_dot);
#if !defined(NDEBUG)
    TBOX_ASSERT(x);
    TBOX_ASSERT(y);
#endif
    *val = PSVR_CAST2(x)->dot(PSVR_CAST2(y));
    IBTK_TIMER_STOP(t_vec_t_dot);
    PetscFunctionReturn(0);
} // VecTDot
开发者ID:knepley,项目名称:IBAMR,代码行数:11,代码来源:PETScSAMRAIVectorReal.cpp

示例9: VecMaxPointwiseDivide_SAMRAI

PetscErrorCode VecMaxPointwiseDivide_SAMRAI(Vec x, Vec y, PetscScalar* max)
{
    IBTK_TIMER_START(t_vec_max_pointwise_divide);
#if !defined(NDEBUG)
    TBOX_ASSERT(x);
    TBOX_ASSERT(y);
#endif
    *max = PSVR_CAST2(x)->maxPointwiseDivide(PSVR_CAST2(y));
    IBTK_TIMER_STOP(t_vec_max_pointwise_divide);
    PetscFunctionReturn(0);
} // VecMaxPointwiseDivide
开发者ID:knepley,项目名称:IBAMR,代码行数:11,代码来源:PETScSAMRAIVectorReal.cpp

示例10: VecTDot_local_SAMRAI

PetscErrorCode VecTDot_local_SAMRAI(Vec x, Vec y, PetscScalar* val)
{
    IBTK_TIMER_START(t_vec_t_dot_local);
#if !defined(NDEBUG)
    TBOX_ASSERT(x);
    TBOX_ASSERT(y);
#endif
    static const bool local_only = true;
    *val = PSVR_CAST2(x)->dot(PSVR_CAST2(y), local_only);
    IBTK_TIMER_STOP(t_vec_t_dot_local);
    PetscFunctionReturn(0);
} // VecTDot_local
开发者ID:knepley,项目名称:IBAMR,代码行数:12,代码来源:PETScSAMRAIVectorReal.cpp

示例11: VecDotNorm2_SAMRAI

PetscErrorCode VecDotNorm2_SAMRAI(Vec s, Vec t, PetscScalar* dp, PetscScalar* nm)
{
    IBTK_TIMER_START(t_vec_dot_norm2);
#if !defined(NDEBUG)
    TBOX_ASSERT(s);
    TBOX_ASSERT(t);
#endif
    *dp = PSVR_CAST2(s)->dot(PSVR_CAST2(t));
    *nm = PSVR_CAST2(t)->dot(PSVR_CAST2(t));
    IBTK_TIMER_STOP(t_vec_dot_norm2);
    PetscFunctionReturn(0);
} // VecDotNorm2_SAMRAI
开发者ID:knepley,项目名称:IBAMR,代码行数:12,代码来源:PETScSAMRAIVectorReal.cpp

示例12: VecSet_SAMRAI

PetscErrorCode VecSet_SAMRAI(Vec x, PetscScalar alpha)
{
    IBTK_TIMER_START(t_vec_set);
#if !defined(NDEBUG)
    TBOX_ASSERT(x);
#endif
    static const bool interior_only = false;
    PSVR_CAST2(x)->setToScalar(alpha, interior_only);
    int ierr = PetscObjectStateIncrease(reinterpret_cast<PetscObject>(x));
    IBTK_CHKERRQ(ierr);
    IBTK_TIMER_STOP(t_vec_set);
    PetscFunctionReturn(0);
} // VecSet
开发者ID:knepley,项目名称:IBAMR,代码行数:13,代码来源:PETScSAMRAIVectorReal.cpp

示例13: VecCopy_SAMRAI

PetscErrorCode VecCopy_SAMRAI(Vec x, Vec y)
{
    IBTK_TIMER_START(t_vec_copy);
#if !defined(NDEBUG)
    TBOX_ASSERT(x);
    TBOX_ASSERT(y);
#endif
    static const bool interior_only = false;
    PSVR_CAST2(y)->copyVector(PSVR_CAST2(x), interior_only);
    int ierr = PetscObjectStateIncrease(reinterpret_cast<PetscObject>(y));
    IBTK_CHKERRQ(ierr);
    IBTK_TIMER_STOP(t_vec_copy);
    PetscFunctionReturn(0);
} // VecCopy
开发者ID:knepley,项目名称:IBAMR,代码行数:14,代码来源:PETScSAMRAIVectorReal.cpp

示例14: IBTK_TIMER_START

bool
CCDivGradHypreLevelSolver::solveSystem(
    SAMRAIVectorReal<NDIM,double>& x,
    SAMRAIVectorReal<NDIM,double>& b)
{
    IBTK_TIMER_START(t_solve_system);

    if (d_enable_logging) plog << d_object_name << "::solveSystem():" << std::endl;

    // Initialize the solver, when necessary.
    const bool deallocate_after_solve = !d_is_initialized;
    if (deallocate_after_solve) initializeSolverState(x,b);

    // Solve the system using the hypre solver.
    static const int comp = 0;
    const int x_idx = x.getComponentDescriptorIndex(comp);
    const int b_idx = b.getComponentDescriptorIndex(comp);

    bool converged = true;
    IntVector<NDIM> chkbrd_mode_id;
#if (NDIM > 2)
    for (chkbrd_mode_id(2) = 0; chkbrd_mode_id(2) < 2; ++chkbrd_mode_id(2))
    {
#endif
        for (chkbrd_mode_id(1) = 0; chkbrd_mode_id(1) < 2; ++chkbrd_mode_id(1))
        {
            for (chkbrd_mode_id(0) = 0; chkbrd_mode_id(0) < 2; ++chkbrd_mode_id(0))
            {
                bool converged_mode = solveSystem(x_idx, b_idx, chkbrd_mode_id);
                if (d_enable_logging)
                {
                    plog << d_object_name << "::solveSystem(): solver " << (converged_mode ? "converged" : "diverged") << "\n"
                         << "chkbrd_mode_id = " << chkbrd_mode_id << "\n"
                         << "iterations = " << d_current_its << "\n"
                         << "residual norm = " << d_current_residual_norm << std::endl;
                }
                converged = converged && converged_mode;
            }
        }
#if (NDIM > 2)
    }
#endif

    // Deallocate the solver, when necessary.
    if (deallocate_after_solve) deallocateSolverState();

    IBTK_TIMER_STOP(t_solve_system);
    return converged;
}// solveSystem
开发者ID:MSV-Project,项目名称:IBAMR,代码行数:49,代码来源:CCDivGradHypreLevelSolver.C

示例15: VecGetLocalSize_SAMRAI

PetscErrorCode
VecGetLocalSize_SAMRAI(
    Vec v,
    PetscInt* n)
{
    IBTK_TIMER_START(t_vec_get_local_size);
#ifdef DEBUG_CHECK_ASSERTIONS
    TBOX_ASSERT(v != PETSC_NULL);
#else
    NULL_USE(v);
#endif
    *n = 0;
    IBTK_TIMER_STOP(t_vec_get_local_size);
    PetscFunctionReturn(0);
}// VecGetLocalSize
开发者ID:MSV-Project,项目名称:IBAMR,代码行数:15,代码来源:PETScSAMRAIVectorReal.C


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