本文整理汇总了C++中problem函数的典型用法代码示例。如果您正苦于以下问题:C++ problem函数的具体用法?C++ problem怎么用?C++ problem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了problem函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: problem
std::vector<DataPoint> Analysis_Impl::getDataPoints(
const std::vector< boost::optional<DiscretePerturbation> >& perturbations) const
{
DataPointVector result;
std::vector<QVariant> variableValues = problem().getVariableValues(perturbations);
if (variableValues.size() == perturbations.size()) {
// problem was able to match all perturbations
result = getDataPoints(variableValues);
}
return result;
}
开发者ID:Rahjou,项目名称:OpenStudio,代码行数:11,代码来源:Analysis.cpp
示例2: map
std::vector<Problem> map(int problems_count, std::vector<std::string> &lines) {
std::vector<Problem> problems;
auto it = lines.cbegin();
for (int i = 0; i < problems_count; ++i) {
Problem problem(it);
problems.push_back(problem);
}
return problems;
}
开发者ID:sikhapol,项目名称:CodeJam.cc,代码行数:11,代码来源:main.cpp
示例3: wasserted
/* "warning" assert -- safe to continue, so we don't throw exception. */
void wasserted(const char *msg, const char *file, unsigned line) {
problem() << "warning Assertion failure " << msg << ' ' << file << ' ' << dec << line << endl;
sayDbContext();
raiseError(0,msg && *msg ? msg : "wassertion failure");
assertionCount.condrollover( ++assertionCount.warning );
#if defined(_DEBUG) || defined(_DURABLEDEFAULTON)
// this is so we notice in buildbot
log() << "\n\n***aborting after wassert() failure in a debug/test build\n\n" << endl;
abort();
#endif
}
开发者ID:andradeandrey,项目名称:mongo,代码行数:12,代码来源:assert_util.cpp
示例4: defined
/**
Deletes the specified file. An exception is not thrown if the specified file does not exist
\param[in] path The path to the file to be deleted.
\throws SCXUnauthorizedFileSystemAccessException The caller does not have the required permission
or path is a directory or path specified a read-only file
The path parameter is permitted to specify relative or absolute path information. Relative
path information is interpreted as relative to the current working directory. To obtain
the current working directory, see GetCurrentDirectory
*/
void SCXFile::Delete(const SCXFilePath& path) {
#if defined(WIN32)
int failure = _wremove(path.Get().c_str());
#elif defined(SCX_UNIX)
std::string localizedPath = SCXFileSystem::EncodePath(path);
int failure = remove(localizedPath.c_str());
#else
#error
#endif
if (failure) {
if (errno == EACCES || errno == EBUSY || errno == EPERM || errno == EROFS) {
throw SCXUnauthorizedFileSystemAccessException(path, SCXFileSystem::GetAttributes(path), SCXSRCLOCATION);
} else if (errno == ENOENT) {
const int existenceOnly = 00;
#if defined(WIN32)
failure = _waccess(path.Get().c_str(), existenceOnly);
#elif defined(SCX_UNIX)
failure = access(localizedPath.c_str(), existenceOnly);
#else
#error
#endif
bool fileStillExists = !failure;
if (fileStillExists) {
// We got ENOENT when trying to remove the file,
// but appearently the file exists. That means that
// the file is not a file but a directory
throw SCXUnauthorizedFileSystemAccessException(path, SCXFileSystem::GetAttributes(path), SCXSRCLOCATION);
} if (errno == EACCES) {
throw SCXUnauthorizedFileSystemAccessException(path, SCXFileSystem::GetAttributes(path), SCXSRCLOCATION);
} else if (errno == EINVAL) {
throw SCXInvalidArgumentException(L"path", L"Invalid format of path " + path.Get(), SCXSRCLOCATION);
} else if (errno != ENOENT) {
std::wstring problem(L"Failed to delete " + path.Get());
throw SCXInternalErrorException(UnexpectedErrno(problem, errno), SCXSRCLOCATION);
}
} else {
std::wstring problem(L"Failed to delete " + path.Get());
throw SCXInternalErrorException(UnexpectedErrno(problem, errno), SCXSRCLOCATION);
}
}
}
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:52,代码来源:scxfile.cpp
示例5: threadRun
void threadRun( MessagingPort * inPort) {
assert( inPort );
setThreadName( "conn" );
TicketHolderReleaser connTicketReleaser( &connTicketHolder );
auto_ptr<MessagingPort> p( inPort );
string otherSide;
Message m;
try {
otherSide = p->farEnd.toString();
while ( 1 ) {
m.reset();
p->clearCounters();
if ( ! p->recv(m) ) {
if( !cmdLine.quiet )
log() << "end connection " << otherSide << endl;
p->shutdown();
break;
}
handler->process( m , p.get() );
networkCounter.hit( p->getBytesIn() , p->getBytesOut() );
}
}
catch ( const SocketException& ) {
log() << "unclean socket shutdown from: " << otherSide << endl;
}
catch ( const std::exception& e ) {
problem() << "uncaught exception (" << e.what() << ")(" << demangleName( typeid(e) ) <<") in PortMessageServer::threadRun, closing connection" << endl;
}
catch ( ... ) {
problem() << "uncaught exception in PortMessageServer::threadRun, closing connection" << endl;
}
handler->disconnected( p.get() );
}
开发者ID:BendustiK,项目名称:mongo,代码行数:41,代码来源:message_server_port.cpp
示例6: LOG
bool Analysis_Impl::addDataPoint(const DataPoint& dataPoint) {
if (m_dataPointsAreInvalid) {
LOG(Info,"Current data points are invalid. Call removeAllDataPoints before adding new ones.");
return false;
}
if (!(dataPoint.problem().uuid() == problem().uuid())) {
LOG(Error,"Cannot add given DataPoint to Analysis '" << name() <<
"', because it is not associated with Problem '" << problem().name() << "'.");
return false;
}
DataPointVector existingDataPoints = getDataPoints(dataPoint.variableValues());
if (existingDataPoints.size() > 0) {
BOOST_ASSERT(existingDataPoints.size() == 1); // dataPoint must be fully specified to be valid
LOG(Info,"DataPoint not added to Analysis '" << name() << "', because it already exists.");
return false;
}
m_dataPoints.push_back(dataPoint);
connectChild(m_dataPoints.back(),true);
onChange(AnalysisObject_Impl::Benign);
return true;
}
开发者ID:Rahjou,项目名称:OpenStudio,代码行数:21,代码来源:Analysis.cpp
示例7: asserted
void asserted(const char *msg, const char *file, unsigned line) {
assertionCount.condrollover( ++assertionCount.regular );
problem() << "Assertion failure " << msg << ' ' << file << ' ' << dec << line << endl;
sayDbContext();
raiseError(0,msg && *msg ? msg : "assertion failure");
lastAssert[0].set(msg, getDbContext().c_str(), file, line);
stringstream temp;
temp << "assertion " << file << ":" << line;
AssertionException e(temp.str(),0);
breakpoint();
throw e;
}
开发者ID:kapouer,项目名称:mongo-debian,代码行数:12,代码来源:assert_util.cpp
示例8: TestExceptions
void TestExceptions() throw(Exception)
{
TS_ASSERT_THROWS_THIS(MatrixVentilationProblem bad_problem("mesh/test/data/y_branch_3d_mesh", 1u),
"Outlet node is not a boundary node");
MatrixVentilationProblem problem("lung/test/data/three_bifurcations");
TS_ASSERT_THROWS_THIS(problem.SolveProblemFromFile("DoesNotExist.txt", "out", "out"), "Could not open file DoesNotExist.txt");
TS_ASSERT_THROWS_THIS(problem.SetPressureAtBoundaryNode(3u, 0.0), "Boundary conditions cannot be set at internal nodes");
TS_ASSERT_THROWS_THIS(problem.SetFluxAtBoundaryNode(3u, 0.0), "Boundary conditions cannot be set at internal nodes");
}
开发者ID:Chaste,项目名称:Old-Chaste-svn-mirror,代码行数:12,代码来源:TestMatrixVentilationProblem.hpp
示例9: problem
void ilp_solution_t::get_reduced_sol(std::set<literal_t> *p_literals, std::set<literal_t> *p_non_eqs, const std::list< hash_set<term_t> > &terms) const {
const ilp_problem_t *prob = problem();
const pg::proof_graph_t *graph = prob->proof_graph();
hash_map<term_t, term_t> t2r;
_getRepresentative(&t2r, terms);
auto reguralized =
[&t2r](const std::list<hash_set<term_t> > &terms, const literal_t &lit) -> literal_t
{
literal_t out(lit);
for (term_idx_t i = 0; i < out.terms.size(); ++i)
{
if (t2r.count(out.terms.at(i)) > 0)
{
out.terms[i] = t2r[out.terms.at(i)];
break;
}
}
return out;
};
// ENUMERATE ELEMENTS OF literals AND non_eqs
for (auto n : graph->nodes())
if (not n.is_equality_node())
if (n.type() == pg::NODE_HYPOTHESIS or n.type() == pg::NODE_OBSERVABLE)
{
variable_idx_t v = problem()->find_variable_with_node(n.index());
if (v >= 0)
if (variable_is_active(v))
{
if (n.is_non_equality_node())
p_non_eqs->insert(reguralized(terms, n.literal()));
else
p_literals->insert(reguralized(terms, n.literal()));
}
}
}
开发者ID:naoya-i,项目名称:phillip,代码行数:40,代码来源:ilp_problem.cpp
示例10: initSimulation
void
InitPolicyInterpolation< mesh_Type >::
initSimulation ( bcContainerPtr_Type /*bchandler*/,
vectorPtr_Type solution )
{
ASSERT ( problem()->hasExactSolution(), "Error: You cannot use the interpolation method if the problem has not an analytical solution." );
Real currentTime = initialTime() - timestep() * bdf()->order();
UInt pressureOffset = uFESpace()->fieldDim() * uFESpace()->dof().numTotalDof();
vectorPtr_Type velocity;
velocity.reset ( new vector_Type ( uFESpace()->map(), Unique ) );
vectorPtr_Type pressure;
pressure.reset ( new vector_Type ( pFESpace()->map(), Unique ) );
*solution = 0.0;
uFESpace()->interpolate ( problem()->uexact(), *velocity, currentTime );
pFESpace()->interpolate ( problem()->pexact(), *pressure, currentTime );
solution->add ( *velocity );
solution->add ( *pressure, pressureOffset );
bdf()->setInitialCondition ( *solution );
currentTime += timestep();
for ( ; currentTime <= initialTime() + timestep() / 2.0; currentTime += timestep() )
{
*solution = 0.0;
*velocity = 0.0;
*pressure = 0.0;
uFESpace()->interpolate ( problem()->uexact(), *velocity, currentTime );
pFESpace()->interpolate ( problem()->pexact(), *pressure, currentTime );
solution->add ( *velocity );
solution->add ( *pressure, pressureOffset );
// Updating bdf
bdf()->shiftRight ( *solution );
}
}
开发者ID:Danniel-UCAS,项目名称:lifev,代码行数:39,代码来源:InitPolicyInterpolation.hpp
示例11: conflicting_writes
void conflicting_writes(host_port *host) {
int connection, err;
err = make_connection_with(host->ip, host->port, &connection);
if(err < 0) {
problem("Connection failure.\n");
exit(-1);
}
printf("Made connection in second thread, file descriptor is %d\n", connection);
err = DONT;
safe_send(connection, &err, sizeof(int));
err = 3000;
safe_send(connection, &err, sizeof(int));
}
开发者ID:IvanMalison,项目名称:grid,代码行数:13,代码来源:conflicting_writes.c
示例12: SockStartupTests
SockStartupTests() {
#if defined(_WIN32)
WSADATA d;
if ( WSAStartup(MAKEWORD(2,2), &d) != 0 ) {
out() << "ERROR: wsastartup failed " << errno << endl;
problem() << "ERROR: wsastartup failed " << errno << endl;
dbexit( EXIT_NTSERVICE_ERROR );
}
#endif
//out() << "ntohl:" << ntohl(256) << endl;
//sendtest();
//listentest();
}
开发者ID:mharris717,项目名称:mongo,代码行数:13,代码来源:sock.cpp
示例13: main
int main(int argc, char *argv[])
{
// Pour accélérer les I/O
//std::ios_base::sync_with_stdio(false);
if(argc != 2)
{
std::cerr << "Nombre d'argument invalide : un unique argument est attendu." << std::endl;
exit(1);
}
std::ifstream input;
input.open (argv[1], std::ios::in);
if (!input.is_open())
{
std::cerr << "Erreur dans l'ouverture du fichier " << argv[1] << std::endl;
exit(1);
}
// Parse le header dans l'entrée standard : récupère nombre de variables et de clauses
unsigned int nbrVar, nbrClauses;
parserHeader(input, nbrVar, nbrClauses);
// Initialise le problème en lisant l'entrée standard
SatProblem problem(input, nbrVar, nbrClauses);
input.close();
// Résout le problème puis affiche la sortie correspondante
#if VERBOSE == 0
if (problem.satisfiability())
return EXIT_SATISFIABLE;
else
return EXIT_UNSATISFIABLE;
#else
if(problem.satisfiability())
{
std::cout << "s SATISFIABLE\n";
const std::vector<std::pair<unsigned, bool> > assign = problem.getAssign();
for(unsigned int k = 0; k < assign.size(); k++)
{
std::cout << "v ";
if (! assign[k].second)
std::cout << "-";
std::cout << assign[k].first << '\n';
}
return EXIT_SATISFIABLE;
}
else
{
std::cout << "s UNSATISFIABLE\n";
return EXIT_UNSATISFIABLE;
}
#endif
}
开发者ID:Artifere,项目名称:Rendu1,代码行数:51,代码来源:main.cpp
示例14: problem
//-----------------------------------------------------------------------------
void dolfin::solve(const Equation& equation,
Function& u,
std::vector<const BoundaryCondition*> bcs,
Parameters parameters)
{
// Solve linear problem
if (equation.is_linear())
{
LinearVariationalProblem problem(*equation.lhs(), *equation.rhs(), u, bcs);
LinearVariationalSolver solver(problem);
solver.parameters.update(parameters);
solver.solve();
}
// Solve nonlinear problem
else
{
NonlinearVariationalProblem problem(*equation.lhs(), u, bcs);
NonlinearVariationalSolver solver(problem);
solver.parameters.update(parameters);
solver.solve();
}
}
开发者ID:alogg,项目名称:dolfin,代码行数:24,代码来源:solve.cpp
示例15: _unindexRecord
/**
* Remove the provided (obj, dl) pair from the provided index.
*/
static void _unindexRecord(NamespaceDetails *d, int idxNo, const BSONObj& obj,
const DiskLoc& dl, bool logIfError = true) {
auto_ptr<IndexDescriptor> desc(CatalogHack::getDescriptor(d, idxNo));
auto_ptr<IndexAccessMethod> iam(CatalogHack::getIndex(desc.get()));
InsertDeleteOptions options;
options.logIfError = logIfError;
int64_t removed;
Status ret = iam->remove(obj, dl, options, &removed);
if (Status::OK() != ret) {
problem() << "Couldn't unindex record " << obj.toString() << " status: "
<< ret.toString() << endl;
}
}
开发者ID:ChowZenki,项目名称:mongo,代码行数:17,代码来源:index_update.cpp
示例16: c
DbSet::~DbSet() {
if ( name_.empty() )
return;
try {
Client::Context c( name_.c_str() );
if ( nsdetails( name_.c_str() ) ) {
string errmsg;
BSONObjBuilder result;
dropCollection( name_, errmsg, result );
}
} catch ( ... ) {
problem() << "exception cleaning up DbSet" << endl;
}
}
开发者ID:mapleoin,项目名称:mongo,代码行数:14,代码来源:dbhelpers.cpp
示例17: problem
boost::optional<DataPoint> Analysis_Impl::getDataPoint(
const std::vector<Measure>& measures) const
{
OptionalDataPoint result;
std::vector<QVariant> variableValues = problem().getVariableValues(measures);
if (variableValues.size() == measures.size()) {
// problem was able to match all measures
DataPointVector intermediate = getDataPoints(variableValues);
OS_ASSERT(intermediate.size() < 2u);
if (intermediate.size() == 1u) {
result = intermediate[0];
}
}
return result;
}
开发者ID:Zicao,项目名称:OpenStudio,代码行数:15,代码来源:Analysis.cpp
示例18: get_servers
int get_servers(char *hostname, int port, int add_slots, host_list **list) {
int connection = 0;
int result = 0;
int err;
err = make_connection_with(hostname, port, &connection);
if(err < 0) {
problem("Failed to connect to retrive servers");
return FAILURE;
}
err = SEND_SERVERS;
do_rpc(&err);
result = receive_host_list(connection, list);
close(connection);
return result;
}
开发者ID:IvanMalison,项目名称:grid,代码行数:15,代码来源:server.c
示例19: verify
void DiagLog::openFile() {
verify( f == 0 );
stringstream ss;
ss << dbpath << "/diaglog." << hex << time(0);
string name = ss.str();
f = new ofstream(name.c_str(), ios::out | ios::binary);
if ( ! f->good() ) {
problem() << "diagLogging couldn't open " << name << endl;
// todo what is this? :
throw 1717;
}
else {
log() << "diagLogging using file " << name << endl;
}
}
开发者ID:Thor1Khan,项目名称:mongo,代码行数:15,代码来源:instance.cpp
示例20: FluctuatingChargeConstraints
void FluctuatingChargePropagator::initialize() {
if (info_->usesFluctuatingCharges()) {
if (info_->getNFluctuatingCharges() > 0) {
hasFlucQ_ = true;
fqConstraints_ = new FluctuatingChargeConstraints(info_);
fqConstraints_->setConstrainRegions(fqParams_->getConstrainRegions());
}
}
if (!hasFlucQ_) {
initialized_ = true;
return;
}
// SimInfo::MoleculeIterator i;
// Molecule::FluctuatingChargeIterator j;
// Molecule* mol;
// Atom* atom;
//
// For single-minima flucq, this ensures a net neutral system, but
// for multiple minima, this is no longer the right thing to do:
//
// for (mol = info_->beginMolecule(i); mol != NULL;
// mol = info_->nextMolecule(i)) {
// for (atom = mol->beginFluctuatingCharge(j); atom != NULL;
// atom = mol->nextFluctuatingCharge(j)) {
// atom->setFlucQPos(0.0);
// atom->setFlucQVel(0.0);
// }
// }
FluctuatingChargeObjectiveFunction flucQobjf(info_, forceMan_,
fqConstraints_);
DynamicVector<RealType> initCoords = flucQobjf.setInitialCoords();
Problem problem(flucQobjf, *(new NoConstraint()), *(new NoStatus()),
initCoords);
EndCriteria endCriteria(1000, 100, 1e-5, 1e-5, 1e-5);
OptimizationMethod* minim = OptimizationFactory::getInstance()->createOptimization("SD", info_);
DumpStatusFunction dsf(info_); // we want a dump file written
// every iteration
minim->minimize(problem, endCriteria);
cerr << "back from minim\n";
initialized_ = true;
}
开发者ID:jmichalka,项目名称:OpenMD,代码行数:48,代码来源:FluctuatingChargePropagator.cpp
注:本文中的problem函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论