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


C++ LOG_SCOPE函数代码示例

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


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

示例1: LOG_SCOPE

void imgRequest::RemoveFromCache()
{
  LOG_SCOPE(gImgLog, "imgRequest::RemoveFromCache");

  if (mIsInCache) {
    // mCacheEntry is nulled out when we have no more observers.
    if (mCacheEntry)
      imgLoader::RemoveFromCache(mCacheEntry);
    else
      imgLoader::RemoveFromCache(mKeyURI);
  }

  mCacheEntry = nsnull;
}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:14,代码来源:imgRequest.cpp

示例2: LOG_SCOPE

std::pair<unsigned int, Real>
ImplicitSystem::adjoint_solve (const QoISet & qoi_indices)
{
  // Log how long the linear solve takes.
  LOG_SCOPE("adjoint_solve()", "ImplicitSystem");

  if (this->assemble_before_solve)
    // Assemble the linear system
    this->assembly (/* get_residual = */ false,
                    /* get_jacobian = */ true);

  // The adjoint problem is linear
  LinearSolver<Number> * linear_solver = this->get_linear_solver();

  // Reset and build the RHS from the QOI derivative
  this->assemble_qoi_derivative(qoi_indices,
                                /* include_liftfunc = */ false,
                                /* apply_constraints = */ true);

  // Our iteration counts and residuals will be sums of the individual
  // results
  std::pair<unsigned int, Real> solver_params =
    this->get_linear_solve_parameters();
  std::pair<unsigned int, Real> totalrval = std::make_pair(0,0.0);

  for (unsigned int i=0; i != this->n_qois(); ++i)
    if (qoi_indices.has_index(i))
      {
        const std::pair<unsigned int, Real> rval =
          linear_solver->adjoint_solve (*matrix, this->add_adjoint_solution(i),
                                        this->get_adjoint_rhs(i),
                                        solver_params.second,
                                        solver_params.first);

        totalrval.first  += rval.first;
        totalrval.second += rval.second;
      }

  this->release_linear_solver(linear_solver);

  // The linear solver may not have fit our constraints exactly
#ifdef LIBMESH_ENABLE_CONSTRAINTS
  for (unsigned int i=0; i != this->n_qois(); ++i)
    if (qoi_indices.has_index(i))
      this->get_dof_map().enforce_adjoint_constraints_exactly
        (this->get_adjoint_solution(i), i);
#endif

  return totalrval;
}
开发者ID:dschwen,项目名称:libmesh,代码行数:50,代码来源:implicit_system.C

示例3: LOG_SCOPE

std::vector<dof_id_type> StatisticsVector<T>::cut_above(Real cut) const
{
  LOG_SCOPE ("cut_above()", "StatisticsVector");

  const dof_id_type n = cast_int<dof_id_type>(this->size());

  std::vector<dof_id_type> cut_indices;
  cut_indices.reserve(n/2);  // Arbitrary

  for (dof_id_type i=0; i<n; i++)
    if ((*this)[i] > cut)
      cut_indices.push_back(i);

  return cut_indices;
}
开发者ID:balborian,项目名称:libmesh,代码行数:15,代码来源:statistics.C

示例4: LOG_SCOPE

void Partitioner::single_partition_range (MeshBase::element_iterator it,
                                          MeshBase::element_iterator end)
{
  LOG_SCOPE("single_partition_range()", "Partitioner");

  for ( ; it != end; ++it)
    {
      Elem * elem = *it;
      elem->processor_id() = 0;

      // Assign all this element's nodes to processor 0 as well.
      for (unsigned int n=0; n<elem->n_nodes(); ++n)
        elem->node_ptr(n)->processor_id() = 0;
    }
}
开发者ID:balborian,项目名称:libmesh,代码行数:15,代码来源:partitioner.C

示例5: LOG_SCOPE

void RadialBasisInterpolation<KDDim,RBF>::interpolate_field_data (const std::vector<std::string> & field_names,
                                                                  const std::vector<Point> & tgt_pts,
                                                                  std::vector<Number> & tgt_vals) const
{
  LOG_SCOPE ("interpolate_field_data()", "RadialBasisInterpolation<>");

  libmesh_experimental();

  const unsigned int
    n_vars    = this->n_field_variables();

  const std::size_t
    n_src_pts = this->_src_pts.size(),
    n_tgt_pts = tgt_pts.size();

  libmesh_assert_equal_to (_weights.size(),    this->_src_vals.size());
  libmesh_assert_equal_to (field_names.size(), this->n_field_variables());

  // If we already have field variables, we assume we are appending.
  // that means the names and ordering better be identical!
  if (this->_names.size() != field_names.size())
    libmesh_error_msg("ERROR:  when adding field data to an existing list the \nvariable list must be the same!");

  for (unsigned int v=0; v<this->_names.size(); v++)
    if (_names[v] != field_names[v])
      libmesh_error_msg("ERROR:  when adding field data to an existing list the \nvariable list must be the same!");


  RBF rbf(_r_bbox);

  tgt_vals.resize (n_tgt_pts*n_vars); /**/ std::fill (tgt_vals.begin(), tgt_vals.end(), Number(0.));

  for (std::size_t tgt=0; tgt<n_tgt_pts; tgt++)
    {
      const Point & p (tgt_pts[tgt]);

      for (std::size_t i=0; i<n_src_pts; i++)
        {
          const Point & x_i(_src_pts[i]);
          const Real
            r_i   = (p - x_i).norm(),
            phi_i = rbf(r_i);

          for (unsigned int var=0; var<n_vars; var++)
            tgt_vals[tgt*n_vars + var] += _weights[i*n_vars + var]*phi_i;
        }
    }
}
开发者ID:friedmud,项目名称:libmesh,代码行数:48,代码来源:radial_basis_interpolation.C

示例6: LOG_SCOPE

void RBEIMEvaluation::rb_solve(DenseVector<Number> & EIM_rhs)
{
  LOG_SCOPE("rb_solve()", "RBEIMEvaluation");

  if(EIM_rhs.size() > get_n_basis_functions())
    libmesh_error_msg("ERROR: N cannot be larger than the number of basis functions in rb_solve");

  if(EIM_rhs.size()==0)
    libmesh_error_msg("ERROR: N must be greater than 0 in rb_solve");

  const unsigned int N = EIM_rhs.size();
  DenseMatrix<Number> interpolation_matrix_N;
  interpolation_matrix.get_principal_submatrix(N, interpolation_matrix_N);

  interpolation_matrix_N.lu_solve(EIM_rhs, RB_solution);
}
开发者ID:rossisimone,项目名称:libmesh,代码行数:16,代码来源:rb_eim_evaluation.C

示例7: LOG_SCOPE

void GLESRenderSpec::report(LogChannel* ch)
{
	LOG_SCOPE(ch, "++ * GLESRenderSpec Report\n");

	LOG(ch, "++ - GL_VENDOR: %s\n", _vendor.c_str());
	LOG(ch, "++ - GL_RENDERER: %s\n", _renderer.c_str());
	LOG(ch, "++ - GL_VERSION: %s\n", _version.c_str());
	LOG(ch, "++ + GL_EXTENSIONS:\n");

	for (StringSet::iterator itr = _extensions.begin(), end = _extensions.end(); itr != end; ++itr)
	{
		LOG(ch, "++   - %s\n", itr->c_str());
	}

	RenderSpec::report(ch);
}
开发者ID:noriter,项目名称:nit,代码行数:16,代码来源:GLESRenderSpec.cpp

示例8: LOG_SCOPE

void UnstructuredMesh::write (const std::string & name,
                              MeshData * mesh_data)
{
  LOG_SCOPE("write()", "Mesh");

  if (mesh_data)
    {
      libmesh_deprecated();
      if (name.rfind(".unv") < name.size())
        UNVIO(*this, mesh_data).write (name);
      else
        libmesh_error_msg("Only UNV output supports MeshData");
    }

  NameBasedIO(*this).write(name);
}
开发者ID:coreymbryant,项目名称:libmesh,代码行数:16,代码来源:unstructured_mesh.C

示例9: __libmesh_tao_gradient

  //---------------------------------------------------------------
  // This function is called by Tao to evaluate the gradient at x
  PetscErrorCode
  __libmesh_tao_gradient(Tao /*tao*/, Vec x, Vec g, void * ctx)
  {
    LOG_SCOPE("gradient()", "TaoOptimizationSolver");

    PetscErrorCode ierr = 0;

    libmesh_assert(x);
    libmesh_assert(g);
    libmesh_assert(ctx);

    // ctx should be a pointer to the solver (it was passed in as void *)
    TaoOptimizationSolver<Number> * solver =
      static_cast<TaoOptimizationSolver<Number> *> (ctx);

    OptimizationSystem & sys = solver->system();

    // We'll use current_local_solution below, so let's ensure that it's consistent
    // with the vector x that was passed in.
    PetscVector<Number> & X_sys = *cast_ptr<PetscVector<Number> *>(sys.solution.get());
    PetscVector<Number> X(x, sys.comm());

    // Perform a swap so that sys.solution points to X
    X.swap(X_sys);
    // Impose constraints on X
    sys.get_dof_map().enforce_constraints_exactly(sys);
    // Update sys.current_local_solution based on X
    sys.update();
    // Swap back
    X.swap(X_sys);

    // We'll also pass the gradient in to the assembly routine
    // so let's make a PETSc vector for that too.
    PetscVector<Number> gradient(g, sys.comm());

    // Clear the gradient prior to assembly
    gradient.zero();

    if (solver->gradient_object != libmesh_nullptr)
      solver->gradient_object->gradient(*(sys.current_local_solution), gradient, sys);
    else
      libmesh_error_msg("Gradient function not defined in __libmesh_tao_gradient");

    gradient.close();

    return ierr;
  }
开发者ID:borisboutkov,项目名称:libmesh,代码行数:49,代码来源:tao_optimization_solver.C

示例10: LOG_SCOPE

void InverseDistanceInterpolation<KDDim>::construct_kd_tree ()
{
#ifdef LIBMESH_HAVE_NANOFLANN

  LOG_SCOPE ("construct_kd_tree()", "InverseDistanceInterpolation<>");

  // Initialize underlying KD tree
  if (_kd_tree.get() == libmesh_nullptr)
    _kd_tree.reset (new kd_tree_t (KDDim,
                                   _point_list_adaptor,
                                   nanoflann::KDTreeSingleIndexAdaptorParams(10 /* max leaf */)));

  libmesh_assert (_kd_tree.get() != libmesh_nullptr);

  _kd_tree->buildIndex();
#endif
}
开发者ID:borisboutkov,项目名称:libmesh,代码行数:17,代码来源:meshfree_interpolation.C

示例11: LOG_SCOPE

/* void cancelAndForgetObserver (in nsresult aStatus); */
NS_IMETHODIMP imgRequestProxy::CancelAndForgetObserver(nsresult aStatus)
{
  if (mCanceled || !mOwner)
    return NS_ERROR_FAILURE;

  LOG_SCOPE(gImgLog, "imgRequestProxy::CancelAndForgetObserver");

  mCanceled = PR_TRUE;

  // Passing false to aNotify means that mListener will still get
  // OnStopRequest, if needed.
  mOwner->RemoveProxy(this, aStatus, PR_FALSE);

  NullOutListener();

  return NS_OK;
}
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:18,代码来源:imgRequestProxy.cpp

示例12: __libmesh_tao_inequality_constraints_jacobian

  //---------------------------------------------------------------
  // This function is called by Tao to evaluate the Jacobian of the
  // equality constraints at x
  PetscErrorCode
  __libmesh_tao_inequality_constraints_jacobian(Tao /*tao*/, Vec x, Mat J, Mat Jpre, void * ctx)
  {
    LOG_SCOPE("inequality_constraints_jacobian()", "TaoOptimizationSolver");

    PetscErrorCode ierr = 0;

    libmesh_assert(x);
    libmesh_assert(J);
    libmesh_assert(Jpre);

    // ctx should be a pointer to the solver (it was passed in as void *)
    TaoOptimizationSolver<Number> * solver =
      static_cast<TaoOptimizationSolver<Number> *> (ctx);

    OptimizationSystem & sys = solver->system();

    // We'll use current_local_solution below, so let's ensure that it's consistent
    // with the vector x that was passed in.
    PetscVector<Number> & X_sys = *cast_ptr<PetscVector<Number> *>(sys.solution.get());
    PetscVector<Number> X(x, sys.comm());

    // Perform a swap so that sys.solution points to X
    X.swap(X_sys);
    // Impose constraints on X
    sys.get_dof_map().enforce_constraints_exactly(sys);
    // Update sys.current_local_solution based on X
    sys.update();
    // Swap back
    X.swap(X_sys);

    // Let's also wrap J and Jpre in PetscMatrix objects for convenience
    PetscMatrix<Number> J_petsc(J, sys.comm());
    PetscMatrix<Number> Jpre_petsc(Jpre, sys.comm());

    if (solver->inequality_constraints_jacobian_object != libmesh_nullptr)
      solver->inequality_constraints_jacobian_object->inequality_constraints_jacobian(*(sys.current_local_solution), J_petsc, sys);
    else
      libmesh_error_msg("Constraints function not defined in __libmesh_tao_inequality_constraints_jacobian");

    J_petsc.close();
    Jpre_petsc.close();

    return ierr;
  }
开发者ID:borisboutkov,项目名称:libmesh,代码行数:48,代码来源:tao_optimization_solver.C

示例13: LOG_SCOPE

void TaoOptimizationSolver<T>::get_dual_variables()
{
  LOG_SCOPE("get_dual_variables()", "TaoOptimizationSolver");

  PetscVector<T> * lambda_eq_petsc =
    cast_ptr<PetscVector<T> *>(this->system().lambda_eq.get());
  PetscVector<T> * lambda_ineq_petsc =
    cast_ptr<PetscVector<T> *>(this->system().lambda_ineq.get());

  Vec lambda_eq_petsc_vec = lambda_eq_petsc->vec();
  Vec lambda_ineq_petsc_vec = lambda_ineq_petsc->vec();

  PetscErrorCode ierr = 0;
  ierr = TaoGetDualVariables(_tao,
                             &lambda_eq_petsc_vec,
                             &lambda_ineq_petsc_vec);
  LIBMESH_CHKERR(ierr);
}
开发者ID:borisboutkov,项目名称:libmesh,代码行数:18,代码来源:tao_optimization_solver.C

示例14: LOG_SCOPE

void Partitioner::single_partition (MeshBase & mesh)
{
  LOG_SCOPE("single_partition()","Partitioner");

  // Loop over all the elements and assign them to processor 0.
  MeshBase::element_iterator       elem_it  = mesh.elements_begin();
  const MeshBase::element_iterator elem_end = mesh.elements_end();

  for ( ; elem_it != elem_end; ++elem_it)
    (*elem_it)->processor_id() = 0;

  // For a single partition, all the nodes are on processor 0
  MeshBase::node_iterator       node_it  = mesh.nodes_begin();
  const MeshBase::node_iterator node_end = mesh.nodes_end();

  for ( ; node_it != node_end; ++node_it)
    (*node_it)->processor_id() = 0;
}
开发者ID:borisboutkov,项目名称:libmesh,代码行数:18,代码来源:partitioner.C

示例15: LOG_SCOPE

Real ErrorVector::mean() const
{
  LOG_SCOPE ("mean()", "ErrorVector");

  const dof_id_type n = cast_int<dof_id_type>(this->size());

  Real the_mean  = 0;
  dof_id_type nnz = 0;

  for (dof_id_type i=0; i<n; i++)
    if (this->is_active_elem(i))
      {
        the_mean += ( static_cast<Real>((*this)[i]) - the_mean ) / (nnz + 1);

        nnz++;
      }

  return the_mean;
}
开发者ID:balborian,项目名称:libmesh,代码行数:19,代码来源:error_vector.C


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