本文整理汇总了C++中simulation函数的典型用法代码示例。如果您正苦于以下问题:C++ simulation函数的具体用法?C++ simulation怎么用?C++ simulation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了simulation函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: simulation
/*
* Load internal state from an archive.
*/
void StructureFactorGrid::loadParameters(Serializable::IArchive &ar)
{
nAtomType_ = simulation().nAtomType();
// Load parameter file parameters
loadInterval(ar);
loadOutputFileName(ar);
loadParameter<int>(ar, "nMode", nMode_);
modes_.allocate(nMode_, nAtomType_);
loadDMatrix<double>(ar, "modes", modes_, nMode_, nAtomType_);
loadParameter<int>(ar, "hMax", hMax_);
loadParameter<LatticeSystem>(ar, "lattice", lattice_);
// Load and broadcast other distributed members
MpiLoader<Serializable::IArchive> loader(*this, ar);
loader.load(nWave_);
waveIntVectors_.allocate(nWave_);
loader.load(waveIntVectors_, nWave_);
loader.load(nStar_);
starIds_.allocate(nStar_);
loader.load(starIds_, nStar_);
starSizes_.allocate(nStar_);
loader.load(starSizes_, nStar_);
loader.load(nSample_);
if (simulation().domain().isMaster()) {
structureFactors_.allocate(nWave_, nMode_);
ar >> structureFactors_;
}
示例2: TestCardiacSimulationArchiveDynamic
void TestCardiacSimulationArchiveDynamic() throw(Exception)
{
#ifdef CHASTE_CAN_CHECKPOINT_DLLS
// run a monodomain simulation
{
CardiacSimulation simulation("heart/test/data/xml/save_monodomain_dynamic.xml");
}
std::string foldername = "SaveMonodomainDynamic";
// compare the files, using the CompareFilesViaHdf5DataReader() method
TS_ASSERT( CompareFilesViaHdf5DataReader("heart/test/data/cardiac_simulations", "save_monodomain_dynamic", false,
foldername, "SimulationResults", true));
FileFinder file(foldername + "_checkpoints/0.2ms/" + foldername + "_0.2ms/archive.arch.0",
RelativeTo::ChasteTestOutput);
TS_ASSERT(file.Exists());
/* If you want to update the .h5 results for this test for any reason, you need to stop the following lines adding to them.
* So uncomment the assert(), run the test, and then do:
cp /tmp/chaste/testoutput/SaveMonodomainDynamic/SimulationResults.h5 heart/test/data/cardiac_simulations/save_monodomain_dynamic.h5
*/
//assert(0);
//resume the simulation
{
CardiacSimulation simulation("heart/test/data/xml/resume_monodomain_dynamic.xml");
}
// compare the files, using the CompareFilesViaHdf5DataReader() method
TS_ASSERT( CompareFilesViaHdf5DataReader("heart/test/data/cardiac_simulations", "resume_monodomain_dynamic", false,
foldername, "SimulationResults", true));
#endif // CHASTE_CAN_CHECKPOINT_DLLS
}
示例3: OscFixedODE
bool PhysicsFixedFactory::create(const char *name, OscObject *object1, OscObject *object2)
{
OscFixed *cons=NULL;
cons = new OscFixedODE(simulation()->odeWorld(),
simulation()->odeSpace(),
name, m_parent, object1, object2);
if (cons)
return simulation()->add_constraint(*cons);
}
示例4: solve
void solve()
{
fc = find_pos( 'F' );
cc = find_pos( 'C' );
simulation( fc, f_p, f_path );
simulation( cc, c_p, c_path );
fout << process() << std::endl;
}
示例5: TestBiWithBath1dSmall
void TestBiWithBath1dSmall() throw(Exception)
{
{ CardiacSimulation simulation("heart/test/data/xml/bidomain_with_bath1d_small.xml"); }
{ CardiacSimulation simulation2("heart/test/data/xml/bidomain_with_bath1d_resume.xml"); }
{
// The default resume file specifies a simulation duration of zero.
// In reality the user should edit the file to specify something sensible...
FileFinder resume_xml("SaveBiWithBath1D_checkpoints/0.1ms/ResumeParameters.xml", RelativeTo::ChasteTestOutput);
TS_ASSERT_THROWS_THIS(CardiacSimulation simulation(resume_xml.GetAbsolutePath()),
"The simulation duration must be positive, not -0.1");
}
}
示例6: OscSphereCHAI
bool HapticsSphereFactory::create(const char *name, float x, float y, float z)
{
OscSphereCHAI *obj = new OscSphereCHAI(simulation()->world(),
name, m_parent);
if (!(obj && simulation()->add_object(*obj)))
return false;
obj->m_position.set(x, y, z);
return true;
}
示例7: OscPistonODE
bool PhysicsPistonFactory::create(const char *name, OscObject *object1,
OscObject *object2, double x, double y,
double z, double ax, double ay, double az)
{
OscPiston *cons=NULL;
cons = new OscPistonODE(simulation()->odeWorld(),
simulation()->odeSpace(),
name, m_parent, object1, object2,
x, y, z, ax, ay, az);
if (cons)
return simulation()->add_constraint(*cons);
}
示例8: OscFreeODE
bool PhysicsFreeFactory::create(const char *name,
OscObject *object1, OscObject *object2)
{
OscFree *cons=NULL;
cons = new OscFreeODE(simulation()->odeWorld(),
simulation()->odeSpace(),
name, m_parent, object1, object2);
cons->m_response->traceOn();
if (cons)
return simulation()->add_constraint(*cons);
}
示例9: OscBallJointODE
bool PhysicsBallJointFactory::create(const char *name, OscObject *object1,
OscObject *object2, double x, double y,
double z)
{
OscBallJoint *cons=NULL;
cons = new OscBallJointODE(simulation()->odeWorld(),
simulation()->odeSpace(),
name, m_parent, object1, object2,
x, y, z);
if (cons)
return simulation()->add_constraint(*cons);
}
示例10: OscPrismODE
bool PhysicsPrismFactory::create(const char *name, float x, float y, float z)
{
OscPrismODE *obj = new OscPrismODE(simulation()->odeWorld(),
simulation()->odeSpace(),
name, m_parent);
if (!(obj && simulation()->add_object(*obj)))
return false;
obj->m_position.set(x, y, z);
return true;
}
示例11: OscHingeODE
bool PhysicsHingeFactory::create(const char *name, OscObject *object1, OscObject *object2,
double x, double y, double z, double ax, double ay, double az)
{
OscHinge *cons=NULL;
cons = new OscHingeODE(simulation()->odeWorld(),
simulation()->odeSpace(),
name, m_parent, object1, object2,
x, y, z, ax, ay, az);
cons->m_response->traceOn();
if (cons)
return simulation()->add_constraint(*cons);
}
示例12: OscSphereInterface
bool InterfaceSphereFactory::create(const char *name, float x, float y, float z)
{
OscSphere *obj = new OscSphereInterface(NULL, name, m_parent);
if (!(obj && simulation()->add_object(*obj)))
return false;
obj->m_position.set(x, y, z);
obj->traceOn();
simulation()->send(0, "/world/sphere/create", "sfff", name, x, y, z);
return true;
}
示例13: PollenOnsetDate
PollenOnsetDateFromFile::PollenOnsetDateFromFile(QString fileName)
: PollenOnsetDate(), data(simulation()->inputFilePath(fileName))
{
DataGrid data(simulation()->inputFilePath(fileName));
for (int i = 0; i < data.rowNumber(); ++i) {
QDate date = stringToValue<QDate>(data.row(i).at(1));
int year = date.year();
if (!yearsFirstLine.contains(year)) {
yearsFirstLine[year] = i;
}
}
QList<int> years = yearsFirstLine.keys();
lastYear = years.last();
}
示例14: OscFixedInterface
bool InterfaceFixedFactory::create(const char *name, OscObject *object1, OscObject *object2)
{
if (!object1) return false;
OscFixed *cons = new OscFixedInterface(name, m_parent, object1, object2);
if (!(cons && simulation()->add_constraint(*cons)))
return false;
cons->traceOn();
simulation()->send(0, "/world/fixed/create", "sss",
name, object1->c_name(), object2?object2->c_name():"world");
return true;
}
示例15: OscHinge2ODE
bool PhysicsHinge2Factory::create(const char *name, OscObject *object1,
OscObject *object2, double x,
double y, double z, double a1x,
double a1y, double a1z, double a2x,
double a2y, double a2z)
{
OscHinge2 *cons=NULL;
cons = new OscHinge2ODE(simulation()->odeWorld(),
simulation()->odeSpace(),
name, m_parent, object1, object2,
x, y, z, a1x, a1y, a1z, a2x, a2y, a2z);
if (cons)
return simulation()->add_constraint(*cons);
}