本文整理汇总了C++中M_throw函数的典型用法代码示例。如果您正苦于以下问题:C++ M_throw函数的具体用法?C++ M_throw怎么用?C++ M_throw使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了M_throw函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: M_throw
void
DynNewtonianMC::swapSystem(Dynamics& oDynamics)
{
#ifdef DYNAMO_DEBUG
if (dynamic_cast<const DynNewtonianMC*>(&oDynamics) == NULL)
M_throw() << "Trying to swap Dynamicss with different derived types!";
#endif
DynNewtonianMC& ol(static_cast<DynNewtonianMC&>(oDynamics));
std::swap(EnergyPotentialStep, ol.EnergyPotentialStep);
std::swap(_W, ol._W);
}
示例2: reinitialise
void
GCellsShearing::initialise(size_t nID)
{
ID=nID;
if (!(Sim->dynamics.BCTypeTest<BCLeesEdwards>()))
derr << "You should not use the shearing neighbour list"
<< " in a system without Lees Edwards BC's" << std::endl;
if (overlink != 1) M_throw() << "Cannot shear with overlinking yet";
reinitialise();
}
示例3: M_throw
Event
IHardSphere::getEvent(const Particle &p1, const Particle &p2) const
{
#ifdef DYNAMO_DEBUG
if (!Sim->dynamics->isUpToDate(p1))
M_throw() << "Particle 1 is not up to date: ID1=" << p1.getID() << ", ID2=" << p2.getID() << ", delay1=" << Sim->dynamics->getParticleDelay(p1);
if (!Sim->dynamics->isUpToDate(p2))
M_throw() << "Particle 2 is not up to date: ID1=" << p1.getID() << ", ID2=" << p2.getID() << ", delay2=" << Sim->dynamics->getParticleDelay(p2);
if (p1 == p2)
M_throw() << "You shouldn't pass p1==p2 events to the interactions!";
#endif
const double d = _diameter->getProperty(p1, p2);
const double dt = Sim->dynamics->SphereSphereInRoot(p1, p2, d);
if (dt != HUGE_VAL)
return Event(p1, dt, INTERACTION, CORE, ID, p2);
return Event(p1, HUGE_VAL, INTERACTION, NONE, ID, p2);
}
示例4: deinit
/*! \brief Destroys any OpenGL resources associated with this
* object.
*/
inline void deinit()
{
#ifdef MAGNET_DEBUG
if (_cl_buffer_acquired)
M_throw() << "Deinitialising a buffer which is acquired by the OpenCL system!";
#endif
_cl_handle = ::cl::BufferGL();
_cl_handle_init = false;
if (_size)
glDeleteBuffersARB(1, &_buffer);
_context = NULL;
_size = 0;
}
示例5: switch
void
IThinThread::runEvent(Particle& p1, Particle& p2, const IntEvent& iEvent)
{
++Sim->eventCount;
double d = (_diameter->getProperty(p1.getID())
+ _diameter->getProperty(p2.getID())) * 0.5;
double d2 = d * d;
double e = (_e->getProperty(p1.getID())
+ _e->getProperty(p2.getID())) * 0.5;
double l = (_lambda->getProperty(p1.getID())
+ _lambda->getProperty(p2.getID())) * 0.5;
double ld2 = d * l * d * l;
double wd = (_wellDepth->getProperty(p1.getID())
+ _wellDepth->getProperty(p2.getID())) * 0.5;
switch (iEvent.getType())
{
case CORE:
{
PairEventData retVal(Sim->dynamics->SmoothSpheresColl(iEvent, e, d2, CORE));
IntEvent event(iEvent);
if (!isCaptured(p1, p2))
{
event.setType(STEP_IN);
retVal.setType(STEP_IN);
ICapture::add(p1, p2);
}
(*Sim->_sigParticleUpdate)(retVal);
Sim->ptrScheduler->fullUpdate(p1, p2);
for (shared_ptr<OutputPlugin> & Ptr : Sim->outputPlugins)
Ptr->eventUpdate(event, retVal);
break;
}
case STEP_OUT:
{
PairEventData retVal(Sim->dynamics->SphereWellEvent(iEvent, -wd, ld2, 0));
if (retVal.getType() != BOUNCE) ICapture::remove(p1, p2);
(*Sim->_sigParticleUpdate)(retVal);
Sim->ptrScheduler->fullUpdate(p1, p2);
for (shared_ptr<OutputPlugin> & Ptr : Sim->outputPlugins)
Ptr->eventUpdate(iEvent, retVal);
break;
}
default:
M_throw() << "Unknown collision type";
}
}
示例6: rpos
int
DynNewtonian::getSquareCellCollision3(const Particle& part, const Vector & origin, const Vector & width) const
{
Vector rpos(part.getPosition() - origin);
Vector vel(part.getVelocity());
Sim->BCs->applyBC(rpos, vel);
int retVal(0);
double time(HUGE_VAL);
#ifdef DYNAMO_DEBUG
for (size_t iDim = 0; iDim < NDIM; ++iDim)
if ((vel[iDim] == 0) && (std::signbit(vel[iDim])))
M_throw() << "You have negative zero velocities, dont use them."
<< "\nPlease think of the neighbour lists.";
#endif
for (size_t iDim = 0; iDim < NDIM; ++iDim)
{
double tmpdt = ((vel[iDim] < 0)
? -rpos[iDim]/vel[iDim]
: (width[iDim]-rpos[iDim]) / vel[iDim]);
if (tmpdt < time)
{
time = tmpdt;
retVal = (vel[iDim] < 0) ? -(iDim+1) : (iDim+1);
}
}
if (((retVal < 0) && (vel[abs(retVal)-1] > 0))
|| ((retVal > 0) && (vel[abs(retVal)-1] < 0)))
M_throw() << "Found an error! retVal " << retVal
<< " vel is " << vel[abs(retVal)-1];
return retVal;
}
示例7: M_throw
IntEvent
IRoughHardSphere::getEvent(const Particle& p1, const Particle& p2) const
{
#ifdef DYNAMO_DEBUG
if (!Sim->dynamics.getLiouvillean().isUpToDate(p1))
M_throw() << "Particle 1 is not up to date";
if (!Sim->dynamics.getLiouvillean().isUpToDate(p2))
M_throw() << "Particle 2 is not up to date";
#endif
#ifdef DYNAMO_DEBUG
if (p1 == p2)
M_throw() << "You shouldn't pass p1==p2 events to the interactions!";
#endif
CPDData colldat(*Sim, p1, p2);
double d2 = (_diameter->getProperty(p1.getID())
+ _diameter->getProperty(p2.getID())) * 0.5;
d2 *= d2;
if (Sim->dynamics.getLiouvillean()
.SphereSphereInRoot(colldat, d2,
p1.testState(Particle::DYNAMIC), p2.testState(Particle::DYNAMIC)))
{
#ifdef DYNAMO_OverlapTesting
if (Sim->dynamics.getLiouvillean().sphereOverlap(colldat, d2))
M_throw() << "Overlapping particles found"
<< ", particle1 " << p1.getID() << ", particle2 "
<< p2.getID() << "\nOverlap = " << (sqrt(colldat.r2) - sqrt(d2))/Sim->dynamics.units().unitLength();
#endif
return IntEvent(p1, p2, colldat.dt, CORE, *this);
}
return IntEvent(p1,p2,HUGE_VAL, NONE, *this);
}
示例8: catch
void
SpSphericalTop::operator<<(const magnet::xml::Node& XML)
{
SpPoint::operator<<(XML);
try {
inertiaConstant
= XML.getAttribute("InertiaConstant").as<double>() * Sim->dynamics.units().unitArea();
}
catch (boost::bad_lexical_cast &)
{
M_throw() << "Failed a lexical cast in CSSphericalTop";
}
}
示例9: catch
void
SpFixedCollider::operator<<(const magnet::xml::Node& XML)
{
range = std::tr1::shared_ptr<CRange>(CRange::getClass(XML, Sim));
try {
spName = XML.getAttribute("Name");
intName = XML.getAttribute("IntName");
}
catch (boost::bad_lexical_cast &)
{
M_throw() << "Failed a lexical cast in SpFixedCollider";
}
}
示例10: M_throw
void
IRotatedParallelCubes::operator<<(const magnet::xml::Node& XML)
{
if (strcmp(XML.getAttribute("Type"),"RotatedParallelCubes"))
M_throw() << "Attempting to load RotatedParallelCubes from "
<< XML.getAttribute("Type") << " entry";
Interaction::operator<<(XML);
try
{
_diameter = Sim->_properties.getProperty(XML.getAttribute("Diameter"),
Property::Units::Length());
_e = Sim->_properties.getProperty(XML.getAttribute("Elasticity"),
Property::Units::Dimensionless());
intName = XML.getAttribute("Name");
magnet::math::operator<<(Rotation, XML.getNode("Rotation"));
}
catch (boost::bad_lexical_cast &)
{
M_throw() << "Failed a lexical cast in CIRotatedParallelCubes";
}
}
示例11: eval
double eval() const
{
switch (deriv)
{
case 0:
return (rp | nhat) - ( Sigma + wallnHatPosition());
case 1:
return (vp | nhat) - velnHatWall();
case 2:
return Delta * Omega * Omega * std::cos(Omega * t);
default:
M_throw() << "Invalid access";
}
}
示例12: padding
size_t padding()
{
switch(_mode)
{
case CPU:
return 1;
case NVIDIA:
return 1024;
case AMD:
return 64 * 256;
default:
M_throw() << "Functor has not yet been built";
}
}
示例13: M_throw
void
TChain::operator<<(const magnet::xml::Node& XML)
{
Topology::operator<<(XML);
for (magnet::xml::Node node = XML.findNode("Molecule"); node.valid(); ++node)
ranges.push_back(shared_ptr<IDRange>(IDRange::getClass(node.getNode("IDRange"), Sim)));
size_t Clength = (*ranges.begin())->size();
for (const shared_ptr<IDRange>& nRange : ranges)
if (nRange->size() != Clength)
M_throw() << "Size mismatch in loading one of the ranges in Chain topology \""
<< _name << "\"";
}
示例14: IDPairRangeChainEnds
IDPairRangeChainEnds(const magnet::xml::Node& XML, const dynamo::Simulation*):
rangeStart(0),rangeEnd(0), interval(0)
{
rangeStart = XML.getAttribute("Start").as<size_t>();
rangeEnd = XML.getAttribute("End").as<size_t>();
interval = XML.getAttribute("Interval").as<size_t>();
//Guarrantee that they are ordered
if (rangeStart > rangeEnd) std::swap(rangeStart, rangeEnd);
if ((rangeEnd - rangeStart + 1) % interval)
M_throw() << "Length of range does not split into an integer"
<< " number of intervals";
}
示例15: part
void
Liouvillean::loadParticleXMLData(const magnet::xml::Node& XML)
{
dout << "Loading Particle Data" << std::endl;
bool outofsequence = false;
for (magnet::xml::Node node = XML.getNode("ParticleData").fastGetNode("Pt");
node.valid(); ++node)
{
if (!node.hasAttribute("ID")
|| node.getAttribute("ID").as<size_t>() != Sim->particleList.size())
outofsequence = true;
Particle part(node, Sim->particleList.size());
part.getVelocity() *= Sim->dynamics.units().unitVelocity();
part.getPosition() *= Sim->dynamics.units().unitLength();
Sim->particleList.push_back(part);
}
if (outofsequence)
dout << "Particle ID's out of sequence!\n"
<< "This can result in incorrect capture map loads etc.\n"
<< "Erase any capture maps in the configuration file so they are regenerated." << std::endl;
Sim->N = Sim->particleList.size();
dout << "Particle count " << Sim->N << std::endl;
if (XML.getNode("ParticleData").hasAttribute("OrientationData"))
{
orientationData.resize(Sim->N);
size_t i(0);
for (magnet::xml::Node node = XML.getNode("ParticleData").fastGetNode("Pt");
node.valid(); ++node, ++i)
{
orientationData[i].orientation << node.getNode("U");
orientationData[i].angularVelocity << node.getNode("O");
double oL = orientationData[i].orientation.nrm();
if (!(oL > 0.0))
M_throw() << "Particle ID " << i
<< " orientation vector is zero!";
//Makes the vector a unit vector
orientationData[i].orientation /= oL;
}
}
}