本文整理汇总了C++中LOG_SCOPE函数的典型用法代码示例。如果您正苦于以下问题:C++ LOG_SCOPE函数的具体用法?C++ LOG_SCOPE怎么用?C++ LOG_SCOPE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOG_SCOPE函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: parallel_object_only
void MeshfreeInterpolation::gather_remote_data ()
{
#ifndef LIBMESH_HAVE_MPI
// no MPI -- no-op
return;
#else
// This function must be run on all processors at once
parallel_object_only();
LOG_SCOPE ("gather_remote_data()", "MeshfreeInterpolation");
this->comm().allgather(_src_pts);
this->comm().allgather(_src_vals);
#endif // LIBMESH_HAVE_MPI
}
开发者ID:borisboutkov,项目名称:libmesh,代码行数:19,代码来源:meshfree_interpolation.C
示例17: LOG_SCOPE
EvalGraphE2Fixture::EvalGraphE2Fixture(bool mirrored)
{
LOG_SCOPE(INFO,"EvalGraphE2Fixture", true);
typedef TestEvalUnitPropertyBase UnitCfg;
typedef TestEvalGraph::EvalUnitDepPropertyBundle UnitDepCfg;
BOOST_TEST_MESSAGE("adding u1");
u1 = eg.addUnit(UnitCfg("plan(a) v plan(b)."));
LOG(INFO,"u1 = " << u1);
BOOST_TEST_MESSAGE("adding u2");
u2 = eg.addUnit(UnitCfg("need(p,C) :- &cost[plan](C). :- need(_,money)."));
LOG(INFO,"u2 = " << u2);
BOOST_TEST_MESSAGE("adding u3");
// u3: EDB will NOT be part of this in the real system, but here it is useful to know what's going on
u3 = eg.addUnit(UnitCfg("use(X) v use(Y) :- plan(P), choose(P,X,Y). choose(a,c,d). choose(b,e,f)."));
LOG(INFO,"u3 = " << u3);
BOOST_TEST_MESSAGE("adding u4");
u4 = eg.addUnit(UnitCfg("need(u,C) :- &cost[use](C). :- need(_,money)."));
LOG(INFO,"u4 = " << u4);
BOOST_TEST_MESSAGE("adding e21");
e21 = eg.addDependency(u2, u1, UnitDepCfg(0));
BOOST_TEST_MESSAGE("adding e31");
e31 = eg.addDependency(u3, u1, UnitDepCfg(0));
LOG(INFO,"mirrored = " << mirrored);
if( mirrored )
{
BOOST_TEST_MESSAGE("adding e43");
e43 = eg.addDependency(u4, u3, UnitDepCfg(0));
BOOST_TEST_MESSAGE("adding e42");
e42 = eg.addDependency(u4, u2, UnitDepCfg(1));
}
else
{
BOOST_TEST_MESSAGE("adding e42");
e42 = eg.addDependency(u4, u2, UnitDepCfg(0));
BOOST_TEST_MESSAGE("adding e43");
e43 = eg.addDependency(u4, u3, UnitDepCfg(1));
}
}
开发者ID:Mustafa226,项目名称:core,代码行数:39,代码来源:fixtureE2.cpp
示例18: LOG_SCOPE
const Elem * PointLocatorTree::perform_linear_search(const Point & p,
const std::set<subdomain_id_type> * allowed_subdomains,
bool use_close_to_point,
Real close_to_point_tolerance) const
{
LOG_SCOPE("perform_linear_search", "PointLocatorTree");
// The type of iterator depends on the Trees::BuildType
// used for this PointLocator. If it's
// TREE_LOCAL_ELEMENTS, we only want to double check
// local elements during this linear search.
MeshBase::const_element_iterator pos =
this->_build_type == Trees::LOCAL_ELEMENTS ?
this->_mesh.active_local_elements_begin() : this->_mesh.active_elements_begin();
const MeshBase::const_element_iterator end_pos =
this->_build_type == Trees::LOCAL_ELEMENTS ?
this->_mesh.active_local_elements_end() : this->_mesh.active_elements_end();
for ( ; pos != end_pos; ++pos)
{
if (!allowed_subdomains ||
allowed_subdomains->count((*pos)->subdomain_id()))
{
if(!use_close_to_point)
{
if ((*pos)->contains_point(p))
return (*pos);
}
else
{
if ((*pos)->close_to_point(p, close_to_point_tolerance))
return (*pos);
}
}
}
return libmesh_nullptr;
}
开发者ID:vityurkiv,项目名称:Ox,代码行数:39,代码来源:point_locator_tree.C
示例19: __libmesh_tao_objective
//---------------------------------------------------------------
// This function is called by Tao to evaluate objective function at x
PetscErrorCode
__libmesh_tao_objective (Tao /*tao*/, Vec x, PetscReal * objective, void * ctx)
{
LOG_SCOPE("objective()", "TaoOptimizationSolver");
PetscErrorCode ierr = 0;
libmesh_assert(x);
libmesh_assert(objective);
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);
if (solver->objective_object != libmesh_nullptr)
(*objective) = solver->objective_object->objective(*(sys.current_local_solution), sys);
else
libmesh_error_msg("Objective function not defined in __libmesh_tao_objective");
return ierr;
}
开发者ID:borisboutkov,项目名称:libmesh,代码行数:40,代码来源:tao_optimization_solver.C
注:本文中的LOG_SCOPE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论