本文整理汇总了C++中TBOX_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ TBOX_ERROR函数的具体用法?C++ TBOX_ERROR怎么用?C++ TBOX_ERROR使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TBOX_ERROR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TBOX_ERROR
void IBHierarchyIntegrator::getFromRestart()
{
Pointer<Database> restart_db = RestartManager::getManager()->getRootDatabase();
Pointer<Database> db;
if (restart_db->isDatabase(d_object_name))
{
db = restart_db->getDatabase(d_object_name);
}
else
{
TBOX_ERROR(d_object_name << ": Restart database corresponding to " << d_object_name
<< " not found in restart file." << std::endl);
}
int ver = db->getInteger("IB_HIERARCHY_INTEGRATOR_VERSION");
if (ver != IB_HIERARCHY_INTEGRATOR_VERSION)
{
TBOX_ERROR(d_object_name << ": Restart file version different than class version."
<< std::endl);
}
d_time_stepping_type =
string_to_enum<TimeSteppingType>(db->getString("d_time_stepping_type"));
d_regrid_cfl_interval = db->getDouble("d_regrid_cfl_interval");
d_regrid_cfl_estimate = db->getDouble("d_regrid_cfl_estimate");
return;
} // getFromRestart
示例2: TBOX_ERROR
void
HierarchyProjector::getFromRestart()
{
Pointer<Database> restart_db =
RestartManager::getManager()->getRootDatabase();
Pointer<Database> db;
if (restart_db->isDatabase(d_object_name))
{
db = restart_db->getDatabase(d_object_name);
}
else
{
TBOX_ERROR(d_object_name << ": \n"
<< "Restart database corresponding to "
<< d_object_name << " not found in restart file.");
}
int ver = db->getInteger("HIERARCHY_PROJECTOR_VERSION");
if (ver != HIERARCHY_PROJECTOR_VERSION)
{
TBOX_ERROR(d_object_name << ": "
<< "Restart file version different than class version.");
}
return;
}// getFromRestart
示例3: if
void GeneralizedIBMethod::interpolateVelocity(
const int u_data_idx,
const std::vector<Pointer<CoarsenSchedule<NDIM> > >& u_synch_scheds,
const std::vector<Pointer<RefineSchedule<NDIM> > >& u_ghost_fill_scheds,
const double data_time)
{
// Interpolate the linear velocities.
IBMethod::interpolateVelocity(u_data_idx, u_synch_scheds, u_ghost_fill_scheds, data_time);
// Interpolate the angular velocities.
std::vector<Pointer<LData> >* W_data = NULL;
if (MathUtilities<double>::equalEps(data_time, d_current_time))
{
W_data = &d_W_current_data;
}
else if (MathUtilities<double>::equalEps(data_time, d_half_time))
{
TBOX_ERROR(d_object_name << "::interpolateVelocity():\n"
<< " time-stepping type MIDPOINT_RULE not supported by "
"class GeneralizedIBMethod;\n"
<< " use TRAPEZOIDAL_RULE instead.\n");
}
else if (MathUtilities<double>::equalEps(data_time, d_new_time))
{
W_data = &d_W_new_data;
}
Pointer<Variable<NDIM> > u_var = d_ib_solver->getVelocityVariable();
Pointer<CellVariable<NDIM, double> > u_cc_var = u_var;
Pointer<SideVariable<NDIM, double> > u_sc_var = u_var;
if (u_cc_var)
{
Pointer<CellVariable<NDIM, double> > w_cc_var = d_w_var;
getHierarchyMathOps()->curl(d_w_idx, w_cc_var, u_data_idx, u_cc_var, NULL, data_time);
}
else if (u_sc_var)
{
Pointer<SideVariable<NDIM, double> > w_sc_var = d_w_var;
getHierarchyMathOps()->curl(d_w_idx, w_sc_var, u_data_idx, u_sc_var, NULL, data_time);
}
else
{
TBOX_ERROR(d_object_name << "::interpolateVelocity():\n"
<< " unsupported velocity data centering" << std::endl);
}
std::vector<Pointer<LData> >* X_LE_data;
bool* X_LE_needs_ghost_fill;
getLECouplingPositionData(&X_LE_data, &X_LE_needs_ghost_fill, data_time);
getVelocityHierarchyDataOps()->scale(d_w_idx, 0.5, d_w_idx);
d_l_data_manager->interp(d_w_idx,
*W_data,
*X_LE_data,
std::vector<Pointer<CoarsenSchedule<NDIM> > >(),
getGhostfillRefineSchedules(d_object_name + "::w"),
data_time);
resetAnchorPointValues(*W_data,
/*coarsest_ln*/ 0,
/*finest_ln*/ d_hierarchy->getFinestLevelNumber());
return;
} // interpolateVelocity
示例4: root_db
/*
*************************************************************************
*
* Read data from restart database.
*
*************************************************************************
*/
void CVODEModel::getFromRestart()
{
std::shared_ptr<Database> root_db(
RestartManager::getManager()->getRootDatabase());
if (!root_db->isDatabase(d_object_name)) {
TBOX_ERROR("Restart database corresponding to "
<< d_object_name << " not found in the restart file.");
}
std::shared_ptr<Database> db(root_db->getDatabase(d_object_name));
int ver = db->getInteger("CVODE_MODEL_VERSION");
if (ver != CVODE_MODEL_VERSION) {
TBOX_ERROR(
d_object_name << ": "
<< "Restart file version different than class version.");
}
d_initial_value = db->getDouble("d_initial_value");
d_scalar_bdry_edge_conds = db->getIntegerVector("d_scalar_bdry_edge_conds");
d_scalar_bdry_node_conds = db->getIntegerVector("d_scalar_bdry_node_conds");
if (d_dim == Dimension(2)) {
d_bdry_edge_val = db->getDoubleVector("d_bdry_edge_val");
} else if (d_dim == Dimension(3)) {
d_scalar_bdry_face_conds =
db->getIntegerVector("d_scalar_bdry_face_conds");
d_bdry_face_val = db->getDoubleVector("d_bdry_face_val");
}
}
示例5: TBOX_ERROR
void Stokes::FACOps::xeqScheduleRRestriction(int p_dst, int p_src,
int v_dst, int v_src,
int dest_ln)
{
/* p */
{
if (!p_rrestriction_coarsen_schedules[dest_ln]) {
TBOX_ERROR("Expected schedule not found.");
}
SAMRAI::xfer::CoarsenAlgorithm coarsener(d_dim);
coarsener.registerCoarsen(p_dst,p_src,p_rrestriction_coarsen_operator);
coarsener.resetSchedule(p_rrestriction_coarsen_schedules[dest_ln]);
p_rrestriction_coarsen_schedules[dest_ln]->coarsenData();
}
/* v */
{
if (!v_rrestriction_coarsen_schedules[dest_ln]) {
TBOX_ERROR("Expected schedule not found.");
}
SAMRAI::xfer::CoarsenAlgorithm coarsener(d_dim);
coarsener.registerCoarsen(v_dst,v_src,v_rrestriction_coarsen_operator);
coarsener.resetSchedule(v_rrestriction_coarsen_schedules[dest_ln]);
v_rrestriction_coarsen_schedules[dest_ln]->coarsenData();
}
}
示例6: pd
bool
CoarsenClasses::itemIsValid(
const CoarsenClasses::Data& data_item,
const std::shared_ptr<hier::PatchDescriptor>& descriptor) const
{
bool item_good = true;
std::shared_ptr<hier::PatchDescriptor> pd(descriptor);
if (!pd) {
pd = hier::VariableDatabase::getDatabase()->getPatchDescriptor();
}
const tbox::Dimension& dim = pd->getPatchDataFactory(data_item.d_dst)->getDim();
const int dst_id = data_item.d_dst;
const int src_id = data_item.d_src;
if (dst_id < 0) {
item_good = false;
TBOX_ERROR("Bad data given to CoarsenClasses...\n"
<< "`Destination' patch data id invalid (< 0!)" << std::endl);
}
if (item_good && (src_id < 0)) {
item_good = false;
TBOX_ERROR("Bad data given to CoarsenClasses...\n"
<< "`Source' patch data id invalid (< 0!)" << std::endl);
}
std::shared_ptr<hier::PatchDataFactory> dfact(
pd->getPatchDataFactory(dst_id));
std::shared_ptr<hier::PatchDataFactory> sfact(
pd->getPatchDataFactory(src_id));
if (item_good && !(sfact->validCopyTo(dfact))) {
item_good = false;
TBOX_ERROR("Bad data given to CoarsenClasses...\n"
<< "It is not a valid operation to copy from `Source' patch data \n"
<< pd->mapIndexToName(src_id) << " to `Destination' patch data "
<< pd->mapIndexToName(dst_id) << std::endl);
}
std::shared_ptr<hier::CoarsenOperator> coarsop(data_item.d_opcoarsen);
if (item_good && coarsop) {
if (coarsop->getStencilWidth(dim) > sfact->getGhostCellWidth()) {
item_good = false;
TBOX_ERROR("Bad data given to CoarsenClasses...\n"
<< "Coarsen operator " << coarsop->getOperatorName()
<< "\nhas larger stencil width than ghost cell width"
<< "of `Source' patch data" << pd->mapIndexToName(src_id)
<< "\noperator stencil width = " << coarsop->getStencilWidth(dim)
<< "\n`Source' ghost width = "
<< sfact->getGhostCellWidth()
<< std::endl);
}
}
return item_good;
}
示例7: TBOX_ERROR
/*
*******************************************************************
* Remove mutual reference between Member and the stage.
* 1. Confirm that the Member is currently on the stage
* (or else it is an illegal operation).
* 2. Remove mutual references.
* 3. Reduce the stage data size by skimming unused space
* off the ends of arrays, if possible.
*******************************************************************
*/
void
AsyncCommStage::privateDestageMember(
Member* member)
{
if (member->hasPendingRequests()) {
TBOX_ERROR("Cannot clear a Member with pending communications.\n"
<< "It would corrupt message passing algorithms.\n");
}
#ifdef DEBUG_CHECK_ASSERTIONS
assertDataConsistency();
#endif
if (getMember(member->d_index_on_stage) != member) {
/*
* Member was not staged with this AsyncCommStage. Since staging
* and destaging are private methods, there must be some logic
* bug in the library.
*/
TBOX_ERROR("Library error: An AsyncCommStage cannot destage a Member\n"
<< "that was not staged with it." << std::endl);
}
d_members[member->d_index_on_stage] = 0;
--d_member_count;
/*
* Remove the ends of the arrays as much as possible without
* shifting arrays. (This is only possible if member is at the
* end.)
*/
size_t min_required_len = d_members.size();
while (min_required_len > 0 && d_members[min_required_len - 1] == 0) {
--min_required_len;
}
if (min_required_len != d_members.size()) {
d_members.resize(min_required_len, 0);
d_member_to_req.resize(d_members.size() + 1,
size_t(MathUtilities<int>::getMax()));
const size_t new_num_req = d_member_to_req[d_member_to_req.size() - 1];
d_req_to_member.resize(new_num_req,
size_t(MathUtilities<int>::getMax()));
d_req.resize(new_num_req, MPI_REQUEST_NULL);
}
member->d_nreq = member->d_index_on_stage = size_t(
MathUtilities<int>::getMax());
member->d_stage = 0;
member->d_handler = 0;
#ifdef DEBUG_CHECK_ASSERTIONS
assertDataConsistency();
#endif
}
示例8: TBOX_ERROR
void
LocationIndexRobinBcCoefs::getFromInput(
const std::shared_ptr<tbox::Database>& input_db)
{
if (!input_db) {
return;
}
for (int i = 0; i < 2 * d_dim.getValue(); ++i) {
std::string name = "boundary_" + tbox::Utilities::intToString(i);
if (input_db->isString(name)) {
d_a_map[i] = 1.0;
d_g_map[i] = 0.0;
std::vector<std::string> specs = input_db->getStringVector(name);
if (specs[0] == "value") {
d_a_map[i] = 1.0;
d_b_map[i] = 0.0;
if (specs.size() != 2) {
TBOX_ERROR("LocationIndexRobinBcCoefs::getFromInput error...\n"
<< "exactly 1 value needed with \"value\" boundary specifier"
<< std::endl);
} else {
d_g_map[i] = atof(specs[1].c_str());
}
} else if (specs[0] == "slope") {
d_a_map[i] = 0.0;
d_b_map[i] = 1.0;
if (specs.size() != 2) {
TBOX_ERROR("LocationIndexRobinBcCoefs::getFromInput error...\n"
<< "exactly 1 value needed with \"slope\" boundary specifier"
<< std::endl);
} else {
d_g_map[i] = atof(specs[1].c_str());
}
} else if (specs[0] == "coefficients") {
if (specs.size() != 3) {
TBOX_ERROR("LocationIndexRobinBcCoefs::getFromInput error...\n"
<< "exactly 2 values needed with \"coefficients\" boundary specifier"
<< std::endl);
} else {
d_a_map[i] = atof(specs[1].c_str());
d_b_map[i] = atof(specs[2].c_str());
}
} else {
TBOX_ERROR(d_object_name << ": Bad boundary specifier\n"
<< "'" << specs[0] << "'. Use either 'value'\n"
<< "'slope' or 'coefficients'.\n");
}
} else {
TBOX_ERROR(d_object_name << ": Missing boundary specifier.\n");
}
}
}
示例9: getMinimumGhostCellWidth
void GeneralizedIBMethod::registerEulerianVariables()
{
IBMethod::registerEulerianVariables();
const IntVector<NDIM> ib_ghosts = getMinimumGhostCellWidth();
const IntVector<NDIM> ghosts = 1;
const IntVector<NDIM> no_ghosts = 0;
Pointer<Variable<NDIM> > u_var = d_ib_solver->getVelocityVariable();
Pointer<CellVariable<NDIM, double> > u_cc_var = u_var;
Pointer<SideVariable<NDIM, double> > u_sc_var = u_var;
if (u_cc_var)
{
d_f_var = new CellVariable<NDIM, double>(d_object_name + "::f", NDIM);
d_w_var = new CellVariable<NDIM, double>(d_object_name + "::w", NDIM);
d_n_var = new CellVariable<NDIM, double>(d_object_name + "::n", NDIM);
}
else if (u_sc_var)
{
d_f_var = new SideVariable<NDIM, double>(d_object_name + "::f");
d_w_var = new SideVariable<NDIM, double>(d_object_name + "::w");
d_n_var = new SideVariable<NDIM, double>(d_object_name + "::n");
}
else
{
TBOX_ERROR(d_object_name << "::registerEulerianVariables():\n"
<< " unsupported velocity data centering" << std::endl);
}
registerVariable(d_f_idx, d_f_var, no_ghosts, d_ib_solver->getScratchContext());
registerVariable(d_w_idx, d_w_var, ib_ghosts, d_ib_solver->getScratchContext());
registerVariable(d_n_idx, d_n_var, ghosts, d_ib_solver->getScratchContext());
return;
} // registerEulerianVariables
示例10: NULL_USE
int
SAMRAI_MPI::Sendrecv(
void* sendbuf, int sendcount, Datatype sendtype, int dest, int sendtag,
void* recvbuf, int recvcount, Datatype recvtype, int source, int recvtag,
Status* status) const
{
#ifndef HAVE_MPI
NULL_USE(sendbuf);
NULL_USE(sendcount);
NULL_USE(sendtype);
NULL_USE(dest);
NULL_USE(sendtag);
NULL_USE(recvbuf);
NULL_USE(recvcount);
NULL_USE(recvtype);
NULL_USE(source);
NULL_USE(recvtag);
NULL_USE(status);
#endif
int rval = MPI_SUCCESS;
if (!s_mpi_is_initialized) {
TBOX_ERROR("SAMRAI_MPI::Send is a no-op without run-time MPI!");
}
#ifdef HAVE_MPI
else {
rval = MPI_Sendrecv(
sendbuf, sendcount, sendtype, dest, sendtag,
recvbuf, recvcount, recvtype, source, recvtag,
d_comm, status);
}
#endif
return rval;
}
示例11: if
void
QInit::getFromInput(Pointer<Database> db)
{
if (db)
{
if (db->keyExists("X"))
{
db->getDoubleArray("X", d_X.data(), NDIM);
}
d_init_type = db->getStringWithDefault("init_type", d_init_type);
if (d_init_type == "GAUSSIAN")
{
d_gaussian_kappa = db->getDoubleWithDefault("kappa", d_gaussian_kappa);
}
else if (d_init_type == "ZALESAK")
{
d_zalesak_r = db->getDoubleWithDefault("zalesak_r", d_zalesak_r);
d_zalesak_slot_w = db->getDoubleWithDefault("zalesak_slot_w", d_zalesak_slot_w);
d_zalesak_slot_l = db->getDoubleWithDefault("zalesak_slot_l", d_zalesak_slot_l);
}
else
{
TBOX_ERROR(d_object_name << "::getFromInput()\n"
<< " invalid initialization type "
<< d_init_type
<< "\n");
}
}
return;
} // getFromInput
示例12: TBOX_ERROR
double
Wall::applyForce(double wall_distance, double /*eval_time*/)
{
// apply forces from this wall. For now time dependence is not implemented.
int sgn = (wall_distance > 0.0) ? 1 : ((wall_distance < 0.0) ? -1 : 0);
if(sgn == 0)
{
TBOX_ERROR ("Particle is on the wall, must be inside the domain");
return 0.0;
}
else
{
// make sure we don't apply forces to particles that moved out of the
// wall area, but haven't been regridded yet.
if (abs(wall_distance) < d_force_distance)
{
return sgn*(d_wall_force_fcn)(abs(wall_distance),d_parameters);
}
else
{
return 0.0;
}
}
} // applyForce
示例13: 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
示例14: TBOX_ERROR
void CartCellRobinPhysBdryOp::fillGhostCellValuesCodim2(
const int patch_data_idx,
const Array<BoundaryBox<NDIM> >& physical_codim2_boxes,
const IntVector<NDIM>& ghost_width_to_fill,
const Patch<NDIM>& patch,
const bool adjoint_op)
{
const int n_physical_codim2_boxes = physical_codim2_boxes.size();
if (n_physical_codim2_boxes == 0) return;
const Box<NDIM>& patch_box = patch.getBox();
Pointer<CartesianPatchGeometry<NDIM> > pgeom = patch.getPatchGeometry();
Pointer<CellData<NDIM, double> > patch_data = patch.getPatchData(patch_data_idx);
const int patch_data_depth = patch_data->getDepth();
const int patch_data_gcw = (patch_data->getGhostCellWidth()).max();
#if !defined(NDEBUG)
if (patch_data_gcw != (patch_data->getGhostCellWidth()).min())
{
TBOX_ERROR(
"CartCellRobinPhysBdryOp::fillGhostCellValuesCodim2():\n"
" patch data for patch data index "
<< patch_data_idx << " does not have uniform ghost cell widths." << std::endl);
}
#endif
const IntVector<NDIM> gcw_to_fill =
IntVector<NDIM>::min(patch_data->getGhostCellWidth(), ghost_width_to_fill);
for (int n = 0; n < n_physical_codim2_boxes; ++n)
{
const BoundaryBox<NDIM>& bdry_box = physical_codim2_boxes[n];
const unsigned int location_index = bdry_box.getLocationIndex();
const Box<NDIM> bc_fill_box =
pgeom->getBoundaryFillBox(bdry_box, patch_box, gcw_to_fill);
for (int d = 0; d < patch_data_depth; ++d)
{
CC_ROBIN_PHYS_BDRY_OP_2_FC(patch_data->getPointer(d),
patch_data_gcw,
location_index,
patch_box.lower(0),
patch_box.upper(0),
patch_box.lower(1),
patch_box.upper(1),
#if (NDIM == 3)
patch_box.lower(2),
patch_box.upper(2),
#endif
bc_fill_box.lower(0),
bc_fill_box.upper(0),
bc_fill_box.lower(1),
bc_fill_box.upper(1),
#if (NDIM == 3)
bc_fill_box.lower(2),
bc_fill_box.upper(2),
#endif
adjoint_op ? 1 : 0);
}
}
return;
} // fillGhostCellValuesCodim2
示例15: TBOX_ASSERT
void BoundaryDataTester::readBoundaryDataStateEntry(
std::shared_ptr<tbox::Database> db,
string& db_name,
int bdry_location_index)
{
TBOX_ASSERT(db);
TBOX_ASSERT(!db_name.empty());
TBOX_ASSERT(d_variable_bc_values.size() == d_variable_name.size());
for (int iv = 0; iv < static_cast<int>(d_variable_name.size()); ++iv) {
#ifdef DEBUG_CHECK_ASSERTIONS
if (d_dim == tbox::Dimension(2)) {
TBOX_ASSERT(static_cast<int>(d_variable_bc_values[iv].size()) ==
NUM_2D_EDGES * d_variable_depth[iv]);
}
if (d_dim == tbox::Dimension(3)) {
TBOX_ASSERT(static_cast<int>(d_variable_bc_values[iv].size()) ==
NUM_3D_FACES * d_variable_depth[iv]);
}
#endif
if (db->keyExists(d_variable_name[iv])) {
int depth = d_variable_depth[iv];
std::vector<double> tmp_val =
db->getDoubleVector(d_variable_name[iv]);
if (static_cast<int>(tmp_val.size()) < depth) {
TBOX_ERROR(d_object_name << ": "
<< "Insufficient number of "
<< d_variable_name[iv] << " values given in "
<< db_name << " input database." << endl);
}
for (int id = 0; id < depth; ++id) {
d_variable_bc_values[iv][bdry_location_index * depth + id] =
tmp_val[id];
}
} else {
TBOX_ERROR(d_object_name << ": "
<< d_variable_name[iv]
<< " entry missing from " << db_name
<< " input database. " << endl);
}
}
}