Commit dca54ec7 authored by Saurabh Belsare's avatar Saurabh Belsare
Browse files

Merged fork with latest original master

parents cace5edf 01f9e415
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
// This file is part of the "Irrlicht Engine" and the "irrXML" project. // This file is part of the "Irrlicht Engine" and the "irrXML" project.
// For conditions of distribution and use, see copyright notice in irrlicht.h and/or irrXML.h // For conditions of distribution and use, see copyright notice in irrlicht.h and/or irrXML.h
// MODIFIED by Peter Eastman, Feb. 4, 2016, to support numeric escape sequences
#ifndef __ICXML_READER_IMPL_H_INCLUDED__ #ifndef __ICXML_READER_IMPL_H_INCLUDED__
#define __ICXML_READER_IMPL_H_INCLUDED__ #define __ICXML_READER_IMPL_H_INCLUDED__
...@@ -529,10 +531,37 @@ private: ...@@ -529,10 +531,37 @@ private:
pos += SpecialCharacters[specialChar].size(); pos += SpecialCharacters[specialChar].size();
} }
else else
{
int semicolonPos = origstr.findNext(L';', pos);
if (semicolonPos != -1 && origstr.c_str()[pos+1] == L'#')
{
// it is a numeric character reference
int number;
core::string<char> numberString;
if (origstr.c_str()[pos+2] == L'x')
{
// hex value
for (int i=pos+3; i<semicolonPos; ++i)
numberString.append((char) origstr[i]);
sscanf(numberString.c_str(), "%x", &number);
}
else
{
// decimal value
for (int i=pos+2; i<semicolonPos; ++i)
numberString.append((char) origstr[i]);
sscanf(numberString.c_str(), "%d", &number);
}
newstr.append(origstr.subString(oldPos, pos - oldPos));
newstr.append((char_type) number);
pos = semicolonPos+1;
}
else
{ {
newstr.append(origstr.subString(oldPos, pos - oldPos + 1)); newstr.append(origstr.subString(oldPos, pos - oldPos + 1));
pos += 1; pos += 1;
} }
}
// find next & // find next &
oldPos = pos; oldPos = pos;
......
...@@ -78,6 +78,7 @@ CompiledExpression& CompiledExpression::operator=(const CompiledExpression& expr ...@@ -78,6 +78,7 @@ CompiledExpression& CompiledExpression::operator=(const CompiledExpression& expr
for (int i = 0; i < (int) operation.size(); i++) for (int i = 0; i < (int) operation.size(); i++)
operation[i] = expression.operation[i]->clone(); operation[i] = expression.operation[i]->clone();
#ifdef LEPTON_USE_JIT #ifdef LEPTON_USE_JIT
if (workspace.size() > 0)
generateJitCode(); generateJitCode();
#endif #endif
return *this; return *this;
......
...@@ -124,14 +124,12 @@ public: ...@@ -124,14 +124,12 @@ public:
}; };
void SFMT::createCheckpoint(std::ostream& stream) { void SFMT::createCheckpoint(std::ostream& stream) {
stream.write((char*) &data->baseData, sizeof(data->baseData)); stream.write((char*) data->sfmt, N*sizeof(w128_t));
stream.write((char*) &data->sfmt, sizeof(data->sfmt));
stream.write((char*) &data->idx, sizeof(data->idx)); stream.write((char*) &data->idx, sizeof(data->idx));
} }
void SFMT::loadCheckpoint(std::istream& stream) { void SFMT::loadCheckpoint(std::istream& stream) {
stream.read((char*) &data->baseData, sizeof(data->baseData)); stream.read((char*) data->sfmt, N*sizeof(w128_t));
stream.read((char*) &data->sfmt, sizeof(data->sfmt));
stream.read((char*) &data->idx, sizeof(data->idx)); stream.read((char*) &data->idx, sizeof(data->idx));
} }
......
...@@ -62,7 +62,7 @@ public: ...@@ -62,7 +62,7 @@ public:
/** /**
* Create a Kernel that wraps a KernelImpl. * Create a Kernel that wraps a KernelImpl.
* *
* @param name the name of the kernel to create * @param KernelImpl the KernelImpl to wrap
*/ */
Kernel(KernelImpl* impl); Kernel(KernelImpl* impl);
~Kernel(); ~Kernel();
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2012 Stanford University and the Authors. * * Portions copyright (c) 2008-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -53,7 +53,7 @@ class KernelFactory; ...@@ -53,7 +53,7 @@ class KernelFactory;
* To get a Platform object, call * To get a Platform object, call
* *
* <pre> * <pre>
* Platform& platform Platform::findPlatform(kernelNames); * Platform& platform = Platform::findPlatform(kernelNames);
* </pre> * </pre>
* *
* passing in the names of all kernels that will be required for the calculation you plan to perform. It * passing in the names of all kernels that will be required for the calculation you plan to perform. It
...@@ -78,6 +78,9 @@ public: ...@@ -78,6 +78,9 @@ public:
/** /**
* Get whether this Platform supports double precision arithmetic. If this returns false, the platform * Get whether this Platform supports double precision arithmetic. If this returns false, the platform
* is permitted to represent double precision values internally as single precision. * is permitted to represent double precision values internally as single precision.
*
* @deprecated This method is not well defined, and is too simplistic to describe the actual behavior of
* some Platforms, such as ones that offer multiple precision modes. It will be removed in a future release.
*/ */
virtual bool supportsDoublePrecision() const = 0; virtual bool supportsDoublePrecision() const = 0;
/** /**
...@@ -233,7 +236,9 @@ protected: ...@@ -233,7 +236,9 @@ protected:
*/ */
const ContextImpl& getContextImpl(const Context& context) const; const ContextImpl& getContextImpl(const Context& context) const;
std::vector<std::string> platformProperties; std::vector<std::string> platformProperties;
std::map<std::string, std::string> deprecatedPropertyReplacements;
private: private:
friend class ContextImpl;
std::map<std::string, KernelFactory*> kernelFactories; std::map<std::string, KernelFactory*> kernelFactories;
std::map<std::string, std::string> defaultProperties; std::map<std::string, std::string> defaultProperties;
static std::vector<Platform*>& getPlatforms(); static std::vector<Platform*>& getPlatforms();
......
...@@ -187,7 +187,7 @@ public: ...@@ -187,7 +187,7 @@ public:
* @param b the vector defining the second edge of the periodic box * @param b the vector defining the second edge of the periodic box
* @param c the vector defining the third edge of the periodic box * @param c the vector defining the third edge of the periodic box
*/ */
virtual void setPeriodicBoxVectors(ContextImpl& context, const Vec3& a, const Vec3& b, const Vec3& c) const = 0; virtual void setPeriodicBoxVectors(ContextImpl& context, const Vec3& a, const Vec3& b, const Vec3& c) = 0;
/** /**
* Create a checkpoint recording the current state of the Context. * Create a checkpoint recording the current state of the Context.
* *
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2012 Stanford University and the Authors. * * Portions copyright (c) 2008-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -89,15 +89,21 @@ void Platform::setPropertyValue(Context& context, const string& property, const ...@@ -89,15 +89,21 @@ void Platform::setPropertyValue(Context& context, const string& property, const
} }
const string& Platform::getPropertyDefaultValue(const string& property) const { const string& Platform::getPropertyDefaultValue(const string& property) const {
map<string, string>::const_iterator value = defaultProperties.find(property); string propertyName = property;
if (deprecatedPropertyReplacements.find(property) != deprecatedPropertyReplacements.end())
propertyName = deprecatedPropertyReplacements.find(property)->second;
map<string, string>::const_iterator value = defaultProperties.find(propertyName);
if (value == defaultProperties.end()) if (value == defaultProperties.end())
throw OpenMMException("getPropertyDefaultValue: Illegal property name"); throw OpenMMException("getPropertyDefaultValue: Illegal property name");
return value->second; return value->second;
} }
void Platform::setPropertyDefaultValue(const string& property, const string& value) { void Platform::setPropertyDefaultValue(const string& property, const string& value) {
string propertyName = property;
if (deprecatedPropertyReplacements.find(property) != deprecatedPropertyReplacements.end())
propertyName = deprecatedPropertyReplacements.find(property)->second;
for (int i = 0; i < (int) platformProperties.size(); i++) for (int i = 0; i < (int) platformProperties.size(); i++)
if (platformProperties[i] == property) { if (platformProperties[i] == propertyName) {
defaultProperties[property] = value; defaultProperties[property] = value;
return; return;
} }
...@@ -314,7 +320,11 @@ const string& Platform::getDefaultPluginsDirectory() { ...@@ -314,7 +320,11 @@ const string& Platform::getDefaultPluginsDirectory() {
#define STRING(x) STRING1(x) #define STRING(x) STRING1(x)
const string& Platform::getOpenMMVersion() { const string& Platform::getOpenMMVersion() {
#if OPENMM_BUILD_VERSION == 0
static const string version = STRING(OPENMM_MAJOR_VERSION) "." STRING(OPENMM_MINOR_VERSION); static const string version = STRING(OPENMM_MAJOR_VERSION) "." STRING(OPENMM_MINOR_VERSION);
#else
static const string version = STRING(OPENMM_MAJOR_VERSION) "." STRING(OPENMM_MINOR_VERSION) "." STRING(OPENMM_BUILD_VERSION);
#endif
return version; return version;
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010-2015 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -159,15 +159,18 @@ public: ...@@ -159,15 +159,18 @@ public:
* new bonds and torsions cannot be added. * new bonds and torsions cannot be added.
*/ */
void updateParametersInContext(Context& context); void updateParametersInContext(Context& context);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void setUsesPeriodicBoundaryConditions(bool periodic);
/** /**
* Returns whether or not this force makes use of periodic boundary * Returns whether or not this force makes use of periodic boundary
* conditions. * conditions.
* *
* @returns false * @returns true if force uses PBC and false otherwise
*/ */
bool usesPeriodicBoundaryConditions() const { bool usesPeriodicBoundaryConditions() const;
return false;
}
protected: protected:
ForceImpl* createImpl() const; ForceImpl* createImpl() const;
private: private:
...@@ -175,6 +178,7 @@ private: ...@@ -175,6 +178,7 @@ private:
class CMAPTorsionInfo; class CMAPTorsionInfo;
std::vector<MapInfo> maps; std::vector<MapInfo> maps;
std::vector<CMAPTorsionInfo> torsions; std::vector<CMAPTorsionInfo> torsions;
bool usePeriodic;
}; };
/** /**
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010-2012 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -203,15 +203,18 @@ public: ...@@ -203,15 +203,18 @@ public:
* the Context. The set of particles involved in a angle cannot be changed, nor can new angles be added. * the Context. The set of particles involved in a angle cannot be changed, nor can new angles be added.
*/ */
void updateParametersInContext(Context& context); void updateParametersInContext(Context& context);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void setUsesPeriodicBoundaryConditions(bool periodic);
/** /**
* Returns whether or not this force makes use of periodic boundary * Returns whether or not this force makes use of periodic boundary
* conditions. * conditions.
* *
* @returns false * @returns true if force uses PBC and false otherwise
*/ */
bool usesPeriodicBoundaryConditions() const { bool usesPeriodicBoundaryConditions() const;
return false;
}
protected: protected:
ForceImpl* createImpl() const; ForceImpl* createImpl() const;
private: private:
...@@ -222,6 +225,7 @@ private: ...@@ -222,6 +225,7 @@ private:
std::vector<AngleParameterInfo> parameters; std::vector<AngleParameterInfo> parameters;
std::vector<GlobalParameterInfo> globalParameters; std::vector<GlobalParameterInfo> globalParameters;
std::vector<AngleInfo> angles; std::vector<AngleInfo> angles;
bool usePeriodic;
}; };
/** /**
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2012 Stanford University and the Authors. * * Portions copyright (c) 2008-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -200,15 +200,18 @@ public: ...@@ -200,15 +200,18 @@ public:
* the Context. The set of particles involved in a bond cannot be changed, nor can new bonds be added. * the Context. The set of particles involved in a bond cannot be changed, nor can new bonds be added.
*/ */
void updateParametersInContext(Context& context); void updateParametersInContext(Context& context);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void setUsesPeriodicBoundaryConditions(bool periodic);
/** /**
* Returns whether or not this force makes use of periodic boundary * Returns whether or not this force makes use of periodic boundary
* conditions. * conditions.
* *
* @returns false * @returns true if force uses PBC and false otherwise
*/ */
bool usesPeriodicBoundaryConditions() const { bool usesPeriodicBoundaryConditions() const;
return false;
}
protected: protected:
ForceImpl* createImpl() const; ForceImpl* createImpl() const;
private: private:
...@@ -219,6 +222,7 @@ private: ...@@ -219,6 +222,7 @@ private:
std::vector<BondParameterInfo> parameters; std::vector<BondParameterInfo> parameters;
std::vector<GlobalParameterInfo> globalParameters; std::vector<GlobalParameterInfo> globalParameters;
std::vector<BondInfo> bonds; std::vector<BondInfo> bonds;
bool usePeriodic;
}; };
/** /**
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2015 Stanford University and the Authors. * * Portions copyright (c) 2008-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -324,15 +324,18 @@ public: ...@@ -324,15 +324,18 @@ public:
* bonds be added. * bonds be added.
*/ */
void updateParametersInContext(Context& context); void updateParametersInContext(Context& context);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void setUsesPeriodicBoundaryConditions(bool periodic);
/** /**
* Returns whether or not this force makes use of periodic boundary * Returns whether or not this force makes use of periodic boundary
* conditions. * conditions.
* *
* @returns false * @returns true if force uses PBC and false otherwise
*/ */
bool usesPeriodicBoundaryConditions() const { bool usesPeriodicBoundaryConditions() const;
return false;
}
protected: protected:
ForceImpl* createImpl() const; ForceImpl* createImpl() const;
private: private:
...@@ -348,6 +351,7 @@ private: ...@@ -348,6 +351,7 @@ private:
std::vector<GroupInfo> groups; std::vector<GroupInfo> groups;
std::vector<BondInfo> bonds; std::vector<BondInfo> bonds;
std::vector<FunctionInfo> functions; std::vector<FunctionInfo> functions;
bool usePeriodic;
}; };
/** /**
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2014 Stanford University and the Authors. * * Portions copyright (c) 2008-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -298,15 +298,18 @@ public: ...@@ -298,15 +298,18 @@ public:
* the Context. The set of particles involved in a bond cannot be changed, nor can new bonds be added. * the Context. The set of particles involved in a bond cannot be changed, nor can new bonds be added.
*/ */
void updateParametersInContext(Context& context); void updateParametersInContext(Context& context);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void setUsesPeriodicBoundaryConditions(bool periodic);
/** /**
* Returns whether or not this force makes use of periodic boundary * Returns whether or not this force makes use of periodic boundary
* conditions. * conditions.
* *
* @returns false * @returns true if force uses PBC and false otherwise
*/ */
bool usesPeriodicBoundaryConditions() const { bool usesPeriodicBoundaryConditions() const;
return false;
}
protected: protected:
ForceImpl* createImpl() const; ForceImpl* createImpl() const;
private: private:
...@@ -320,6 +323,7 @@ private: ...@@ -320,6 +323,7 @@ private:
std::vector<GlobalParameterInfo> globalParameters; std::vector<GlobalParameterInfo> globalParameters;
std::vector<BondInfo> bonds; std::vector<BondInfo> bonds;
std::vector<FunctionInfo> functions; std::vector<FunctionInfo> functions;
bool usePeriodic;
}; };
/** /**
......
...@@ -369,8 +369,8 @@ public: ...@@ -369,8 +369,8 @@ public:
* Get the donor and acceptor in a pair whose interaction should be excluded. * Get the donor and acceptor in a pair whose interaction should be excluded.
* *
* @param index the index of the exclusion for which to get donor and acceptor indices * @param index the index of the exclusion for which to get donor and acceptor indices
* @param[out] particle1 the index of the donor * @param[out] donor the index of the donor
* @param[out] particle2 the index of the acceptor * @param[out] acceptor the index of the acceptor
*/ */
void getExclusionParticles(int index, int& donor, int& acceptor) const; void getExclusionParticles(int index, int& donor, int& acceptor) const;
/** /**
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2011-2012 Stanford University and the Authors. * * Portions copyright (c) 2011-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -266,15 +266,15 @@ public: ...@@ -266,15 +266,15 @@ public:
/** /**
* Begin an "if" block. * Begin an "if" block.
*/ */
BeginIfBlock = 6, IfBlockStart = 6,
/** /**
* Begin a while" block. * Begin a while" block.
*/ */
BeginWhileBlock = 7, WhileBlockStart = 7,
/** /**
* End an "if" or "while" block. * End an "if" or "while" block.
*/ */
EndBlock = 8 BlockEnd = 8
}; };
/** /**
* Create a CustomIntegrator. * Create a CustomIntegrator.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment