本文整理汇总了C++中STOP_LOG函数的典型用法代码示例。如果您正苦于以下问题:C++ STOP_LOG函数的具体用法?C++ STOP_LOG怎么用?C++ STOP_LOG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了STOP_LOG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: START_LOG
void DerivedRBConstruction<RBConstruction>::load_rb_solution()
{
START_LOG("load_rb_solution()", "DerivedRBConstruction");
solution->zero();
if(get_rb_evaluation().RB_solution.size() > get_rb_evaluation().get_n_basis_functions())
{
libMesh::err << "ERROR: rb_eval contains " << get_rb_evaluation().get_n_basis_functions() << " basis functions."
<< " RB_solution vector constains " << get_rb_evaluation().RB_solution.size() << " entries."
<< " RB_solution in RBConstruction::load_rb_solution is too long!" << std::endl;
libmesh_error();
}
DerivedRBEvaluation<RBEvaluation>& der_rb_eval =
libmesh_cast_ref<DerivedRBEvaluation<RBEvaluation>&>(get_rb_evaluation());
EquationSystems& es = this->get_equation_systems();
RBConstruction& uber_system = es.get_system<RBConstruction>(uber_system_name);
for(unsigned int i=0; i<get_rb_evaluation().RB_solution.size(); i++)
for(unsigned int j=0; j<uber_system.get_rb_evaluation().get_n_basis_functions(); j++)
{
solution->add(get_rb_evaluation().RB_solution(i)*der_rb_eval.derived_basis_functions[i](j),
uber_system.get_rb_evaluation().get_basis_function(j));
}
update();
STOP_LOG("load_rb_solution()", "DerivedRBConstruction");
}
示例2: START_LOG
void RBEvaluation::clear()
{
START_LOG("clear()", "RBEvaluation");
// Clear the basis functions
for(unsigned int i=0; i<basis_functions.size(); i++)
{
if (basis_functions[i])
{
basis_functions[i]->clear();
delete basis_functions[i];
basis_functions[i] = NULL;
}
}
set_n_basis_functions(0);
clear_riesz_representors();
// Clear the Greedy param list
for(unsigned int i=0; i<greedy_param_list.size(); i++)
greedy_param_list[i].clear();
greedy_param_list.clear();
STOP_LOG("clear()", "RBEvaluation");
}
示例3: START_LOG
void NewmarkSystem::update_rhs ()
{
START_LOG("update_rhs ()", "NewmarkSystem");
// zero the rhs-vector
NumericVector<Number> & the_rhs = *this->rhs;
the_rhs.zero();
// get writable references to some vectors
NumericVector<Number> & rhs_m = this->get_vector("rhs_m");
NumericVector<Number> & rhs_c = this->get_vector("rhs_c");
// zero the vectors for matrix-vector product
rhs_m.zero();
rhs_c.zero();
// compute auxiliary vectors rhs_m and rhs_c
rhs_m.add(_a_0, this->get_vector("displacement"));
rhs_m.add(_a_2, this->get_vector("velocity"));
rhs_m.add(_a_3, this->get_vector("acceleration"));
rhs_c.add(_a_1, this->get_vector("displacement"));
rhs_c.add(_a_4, this->get_vector("velocity"));
rhs_c.add(_a_5, this->get_vector("acceleration"));
// compute rhs
the_rhs.add(this->get_vector("force"));
the_rhs.add_vector(rhs_m, this->get_matrix("mass"));
the_rhs.add_vector(rhs_c, this->get_matrix("damping"));
STOP_LOG("update_rhs ()", "NewmarkSystem");
}
示例4: START_LOG
Real StatisticsVector<T>::median()
{
const dof_id_type n = cast_int<dof_id_type>(this->size());
if (n == 0)
return 0.;
START_LOG ("median()", "StatisticsVector");
std::sort(this->begin(), this->end());
const dof_id_type lhs = (n-1) / 2;
const dof_id_type rhs = n / 2;
Real the_median = 0;
if (lhs == rhs)
{
the_median = static_cast<Real>((*this)[lhs]);
}
else
{
the_median = ( static_cast<Real>((*this)[lhs]) +
static_cast<Real>((*this)[rhs]) ) / 2.0;
}
STOP_LOG ("median()", "StatisticsVector");
return the_median;
}
示例5: START_LOG
void RBEIMConstruction::update_RB_system_matrices()
{
START_LOG("update_RB_system_matrices()", "RBEIMConstruction");
Parent::update_RB_system_matrices();
unsigned int RB_size = get_rb_evaluation().get_n_basis_functions();
RBEIMEvaluation& eim_eval = cast_ref<RBEIMEvaluation&>(get_rb_evaluation());
// update the EIM interpolation matrix
for(unsigned int j=0; j<RB_size; j++)
{
// Sample the basis functions at the
// new interpolation point
get_rb_evaluation().get_basis_function(j).localize(*_ghosted_meshfunction_vector, this->get_dof_map().get_send_list());
if(!_performing_extra_greedy_step)
{
eim_eval.interpolation_matrix(RB_size-1,j) =
evaluate_mesh_function( eim_eval.interpolation_points_var[RB_size-1],
eim_eval.interpolation_points[RB_size-1] );
}
else
{
eim_eval.extra_interpolation_matrix_row(j) =
evaluate_mesh_function( eim_eval.extra_interpolation_point_var,
eim_eval.extra_interpolation_point );
}
}
STOP_LOG("update_RB_system_matrices()", "RBEIMConstruction");
}
示例6: START_LOG
std::pair<unsigned int, Real> LinearSolver<T>::adjoint_solve (SparseMatrix<T> & mat,
NumericVector<T>& sol,
NumericVector<T>& rhs,
const double tol,
const unsigned int n_iter)
{
// Log how long the linear solve takes.
START_LOG("adjoint_solve()", "LinearSolver");
// Take the discrete adjoint
mat.close();
mat.get_transpose(mat);
// Call the solve function for the relevant linear algebra library and
// solve the transpose matrix
const std::pair<unsigned int, Real> totalrval = this->solve (mat, sol, rhs, tol, n_iter);
// Now transpose back and restore the original matrix
// by taking the discrete adjoint
mat.get_transpose(mat);
// Stop logging the nonlinear solve
STOP_LOG("adjoint_solve()", "LinearSolver");
return totalrval;
}
示例7: START_LOG
void PetscDiffSolver::init ()
{
START_LOG("init()", "PetscDiffSolver");
Parent::init();
int ierr=0;
#if PETSC_VERSION_LESS_THAN(2,1,2)
// At least until Petsc 2.1.1, the SNESCreate had a different
// calling syntax. The second argument was of type SNESProblemType,
// and could have a value of either SNES_NONLINEAR_EQUATIONS or
// SNES_UNCONSTRAINED_MINIMIZATION.
ierr = SNESCreate(libMesh::COMM_WORLD, SNES_NONLINEAR_EQUATIONS, &_snes);
CHKERRABORT(libMesh::COMM_WORLD,ierr);
#else
ierr = SNESCreate(libMesh::COMM_WORLD,&_snes);
CHKERRABORT(libMesh::COMM_WORLD,ierr);
#endif
#if PETSC_VERSION_LESS_THAN(2,3,3)
ierr = SNESSetMonitor (_snes, __libmesh_petsc_diff_solver_monitor,
this, PETSC_NULL);
#else
// API name change in PETSc 2.3.3
ierr = SNESMonitorSet (_snes, __libmesh_petsc_diff_solver_monitor,
this, PETSC_NULL);
#endif
CHKERRABORT(libMesh::COMM_WORLD,ierr);
ierr = SNESSetFromOptions(_snes);
CHKERRABORT(libMesh::COMM_WORLD,ierr);
STOP_LOG("init()", "PetscDiffSolver");
}
示例8: START_LOG
Real StatisticsVector<T>::median()
{
const unsigned int n = this->size();
if (n == 0)
return 0.;
START_LOG ("median()", "StatisticsVector");
std::sort(this->begin(), this->end());
const unsigned int lhs = (n-1) / 2;
const unsigned int rhs = n / 2;
Real median = 0;
if (lhs == rhs)
{
median = static_cast<Real>((*this)[lhs]);
}
else
{
median = ( static_cast<Real>((*this)[lhs]) +
static_cast<Real>((*this)[rhs]) ) / 2.0;
}
STOP_LOG ("median()", "StatisticsVector");
return median;
}
示例9: compute_affine_map
void FEMap::compute_map(const unsigned int dim,
const std::vector<Real>& qw,
const Elem* elem)
{
if (elem->has_affine_map())
{
compute_affine_map(dim, qw, elem);
return;
}
// Start logging the map computation.
START_LOG("compute_map()", "FEMap");
libmesh_assert(elem);
const unsigned int n_qp = libmesh_cast_int<unsigned int>(qw.size());
// Resize the vectors to hold data at the quadrature points
this->resize_quadrature_map_vectors(dim, n_qp);
// Compute map at all quadrature points
for (unsigned int p=0; p!=n_qp; p++)
this->compute_single_point_map(dim, qw, elem, p);
// Stop logging the map computation.
STOP_LOG("compute_map()", "FEMap");
}
示例10: START_LOG
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
{
START_LOG("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))
{
STOP_LOG("perform_linear_search", "PointLocatorTree");
return (*pos);
}
}
else
{
if ((*pos)->close_to_point(p, close_to_point_tolerance))
{
STOP_LOG("perform_linear_search", "PointLocatorTree");
return (*pos);
}
}
}
}
STOP_LOG("perform_linear_search", "PointLocatorTree");
return NULL;
}
示例11: START_LOG
T StatisticsVector<T>::maximum() const
{
START_LOG ("maximum()", "StatisticsVector");
const T max = *(std::max_element(this->begin(), this->end()));
STOP_LOG ("maximum()", "StatisticsVector");
return max;
}
示例12: START_LOG
void GnuPlotIO::write_nodal_data (const std::string& fname,
const std::vector<Number>& soln,
const std::vector<std::string>& names)
{
START_LOG("write_nodal_data()", "GnuPlotIO");
this->write_solution(fname, &soln, &names);
STOP_LOG("write_nodal_data()", "GnuPlotIO");
}
示例13: START_LOG
void EquationSystems::update ()
{
START_LOG("update()","EquationSystems");
// Localize each system's vectors
for (unsigned int i=0; i != this->n_systems(); ++i)
this->get_system(i).update();
STOP_LOG("update()","EquationSystems");
}
示例14: libmesh_assert
void MeshData::translate (const MeshBase & out_mesh,
std::vector<Number> & values,
std::vector<std::string> & names) const
{
libmesh_assert (_active || _compatibility_mode);
START_LOG("translate()", "MeshData");
const unsigned int n_comp = this->n_val_per_node();
// transfer our nodal data to a vector
// that may be written concurrently
// with the \p out_mesh.
{
// reserve memory for the nodal data
values.reserve(n_comp*out_mesh.n_nodes());
// iterate over the mesh's nodes
MeshBase::const_node_iterator nodes_it = out_mesh.nodes_begin();
const MeshBase::const_node_iterator nodes_end = out_mesh.nodes_end();
// Do not use the \p get_data() method, but the operator()
// method, since this returns by default a zero value,
// when there is no nodal data.
for (; nodes_it != nodes_end; ++nodes_it)
{
const Node * node = *nodes_it;
for (unsigned int c= 0; c<n_comp; c++)
values.push_back(this->operator()(node, c));
}
}
// Now we have the data, nicely stored in \p values.
// It remains to give names to the data, then write to
// file.
{
names.reserve(n_comp);
// this naming scheme only works up to n_comp=100
// (at least for gmv-accepted variable names)
libmesh_assert_less (n_comp, 100);
for (unsigned int n=0; n<n_comp; n++)
{
std::ostringstream name_buf;
name_buf << "bc_" << n;
names.push_back(name_buf.str());
}
}
STOP_LOG("translate()", "MeshData");
}
示例15: START_LOG
std::pair<unsigned int, Real>
PetscDMNonlinearSolver<T>::solve (SparseMatrix<T>& jac_in, // System Jacobian Matrix
NumericVector<T>& x_in, // Solution vector
NumericVector<T>& r_in, // Residual vector
const double, // Stopping tolerance
const unsigned int)
{
START_LOG("solve()", "PetscNonlinearSolver");
this->init ();
// Make sure the data passed in are really of Petsc types
libmesh_cast_ptr<PetscMatrix<T>*>(&jac_in);
libmesh_cast_ptr<PetscVector<T>*>(&r_in);
// Extract solution vector
PetscVector<T>* x = libmesh_cast_ptr<PetscVector<T>*>(&x_in);
int ierr=0;
int n_iterations =0;
// Should actually be a PetscReal, but I don't know which version of PETSc first introduced PetscReal
Real final_residual_norm=0.;
if (this->user_presolve)
this->user_presolve(this->system());
//Set the preconditioning matrix
if (this->_preconditioner)
this->_preconditioner->set_matrix(jac_in);
ierr = SNESSolve (this->_snes, PETSC_NULL, x->vec());
CHKERRABORT(libMesh::COMM_WORLD,ierr);
ierr = SNESGetIterationNumber(this->_snes,&n_iterations);
CHKERRABORT(libMesh::COMM_WORLD,ierr);
ierr = SNESGetLinearSolveIterations(this->_snes, &this->_n_linear_iterations);
CHKERRABORT(libMesh::COMM_WORLD,ierr);
ierr = SNESGetFunctionNorm(this->_snes,&final_residual_norm);
CHKERRABORT(libMesh::COMM_WORLD,ierr);
// Get and store the reason for convergence
SNESGetConvergedReason(this->_snes, &this->_reason);
//Based on Petsc 2.3.3 documentation all diverged reasons are negative
this->converged = (this->_reason >= 0);
this->clear();
STOP_LOG("solve()", "PetscNonlinearSolver");
// return the # of its. and the final residual norm.
return std::make_pair(n_iterations, final_residual_norm);
}