/usr/include/liggghts/contact_models.h is in libliggghts-dev 3.0.3+repack-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | /* ----------------------------------------------------------------------
LIGGGHTS - LAMMPS Improved for General Granular and Granular Heat
Transfer Simulations
LIGGGHTS is part of the CFDEMproject
www.liggghts.com | www.cfdem.com
Christoph Kloss, christoph.kloss@cfdem.com
Copyright 2009-2012 JKU Linz
Copyright 2012- DCS Computing GmbH, Linz
LIGGGHTS is based on LAMMPS
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
This software is distributed under the GNU General Public License.
See the README file in the top-level directory.
------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
Contributing authors:
Christoph Kloss (JKU Linz, DCS Computing GmbH, Linz)
Richard Berger (JKU Linz)
------------------------------------------------------------------------- */
#ifndef CONTACT_MODELS_H_
#define CONTACT_MODELS_H_
#define STATIC_ASSERT(X)
#include "pointers.h"
#include "lammps.h"
#include "contact_interface.h"
#include "property_registry.h"
#include "pair_gran.h"
#include "settings.h"
#include "contact_model_constants.h"
using namespace LAMMPS_NS;
namespace LIGGGHTS {
namespace ContactModels
{
static const int CM_REGISTER_SETTINGS = 1 << 0;
static const int CM_CONNECT_TO_PROPERTIES = 1 << 1;
static const int CM_BEGIN_PASS = 1 << 2;
static const int CM_END_PASS = 1 << 3;
static const int CM_COLLISION = 1 << 4;
static const int CM_NO_COLLISION = 1 << 5;
static const int TOUCH_NORMAL_MODEL = 1 << 0;
static const int TOUCH_COHESION_MODEL = 1 << 1;
static const int TOUCH_TANGENTIAL_MODEL = 1 << 2;
static const int TOUCH_ROLLING_MODEL = 1 << 3;
static const int TOUCH_SURFACE_MODEL = 1 << 4;
static const int TOUCH_FIX = 1 << 31;
template
<
int M,
int T = TANGENTIAL_NO_HISTORY,
int C = COHESION_OFF,
int R = ROLLING_OFF,
int S = SURFACE_DEFAULT
>
struct GranStyle
{
public:
static const int MODEL = M;
static const int TANGENTIAL = T;
static const int COHESION = C;
static const int ROLLING = R;
static const int SURFACE = S;
static const int64_t HASHCODE =
(((int64_t)M)) |
(((int64_t)T) << 4) |
(((int64_t)C) << 8) |
(((int64_t)R) << 12) |
(((int64_t)S) << 16);
};
int64_t generate_gran_hashcode(int model, int tangential, int cohesion, int rolling, int surface);
template<int Model>
class SurfaceModel {
public:
SurfaceModel(LAMMPS * lmp, IContactHistorySetup * hsetup);
inline void beginPass(CollisionData & cdata, ForceData & i_forces, ForceData & j_forces);
inline void endPass(CollisionData & cdata, ForceData & i_forces, ForceData & j_forces);
inline void registerSettings(Settings & settings);
inline void connectToProperties(PropertyRegistry & registry);
inline void collision(CollisionData & cdata, ForceData & i_forces, ForceData & j_forces);
inline void noCollision(ContactData & cdata, ForceData & i_forces, ForceData & j_forces);
};
template<int Model>
class NormalModel {
public:
NormalModel(LAMMPS * lmp, IContactHistorySetup * hsetup);
inline void beginPass(CollisionData & cdata, ForceData & i_forces, ForceData & j_forces);
inline void endPass(CollisionData & cdata, ForceData & i_forces, ForceData & j_forces);
inline void registerSettings(Settings & settings);
inline void connectToProperties(PropertyRegistry & registry);
inline void collision(CollisionData & cdata, ForceData & i_forces, ForceData & j_forces);
inline void noCollision(ContactData & cdata, ForceData & i_forces, ForceData & j_forces);
inline double stressStrainExponent();
};
template<int Model>
class TangentialModel {
public:
TangentialModel(LAMMPS * lmp, IContactHistorySetup * hsetup);
inline void beginPass(CollisionData & cdata, ForceData & i_forces, ForceData & j_forces);
inline void endPass(CollisionData & cdata, ForceData & i_forces, ForceData & j_forces);
inline void registerSettings(Settings & settings);
inline void connectToProperties(PropertyRegistry & registry);
inline void collision(CollisionData & cdata, ForceData & i_forces, ForceData & j_forces);
inline void noCollision(ContactData & cdata, ForceData & i_forces, ForceData & j_forces);
};
template<int Model>
class CohesionModel {
public:
CohesionModel(LAMMPS * lmp, IContactHistorySetup * hsetup);
void beginPass(CollisionData & cdata, ForceData & i_forces, ForceData & j_forces);
void endPass(CollisionData & cdata, ForceData & i_forces, ForceData & j_forces);
void registerSettings(Settings & settings);
void connectToProperties(PropertyRegistry & registry);
void collision(CollisionData & cdata, ForceData & i_forces, ForceData & j_forces);
void noCollision(ContactData & cdata, ForceData & i_forces, ForceData & j_forces);
};
template<int Model>
class RollingModel {
public:
RollingModel(LAMMPS * lmp, IContactHistorySetup * hsetup);
void beginPass(CollisionData & cdata, ForceData & i_forces, ForceData & j_forces);
void endPass(CollisionData & cdata, ForceData & i_forces, ForceData & j_forces);
void registerSettings(Settings & settings);
void connectToProperties(PropertyRegistry & registry);
void collision(CollisionData & cdata, ForceData & i_forces, ForceData & j_forces);
void noCollision(ContactData & cdata, ForceData & i_forces, ForceData & j_forces);
};
template<typename Style>
class ContactModel {
private:
SurfaceModel<Style::SURFACE> surfaceModel;
NormalModel<Style::MODEL> normalModel;
CohesionModel<Style::COHESION> cohesionModel;
TangentialModel<Style::TANGENTIAL> tangentialModel;
RollingModel<Style::ROLLING> rollingModel;
public:
static const int64_t STYLE_HASHCODE = Style::HASHCODE;
static const int MASK = SurfaceModel<Style::SURFACE>::MASK |
NormalModel<Style::MODEL>::MASK |
CohesionModel<Style::COHESION>::MASK |
TangentialModel<Style::TANGENTIAL>::MASK |
RollingModel<Style::ROLLING>::MASK;
static const int HANDLE_REGISTER_SETTINGS = MASK & CM_REGISTER_SETTINGS;
static const int HANDLE_CONNECT_TO_PROPERTIES = MASK & CM_CONNECT_TO_PROPERTIES;
static const int HANDLE_BEGIN_PASS = MASK & CM_BEGIN_PASS;
static const int HANDLE_END_PASS = MASK & CM_END_PASS;
static const int HANDLE_COLLISION = MASK & CM_COLLISION;
static const int HANDLE_NO_COLLISION = MASK & CM_NO_COLLISION;
ContactModel(LAMMPS * lmp, IContactHistorySetup * hsetup) :
surfaceModel(lmp, hsetup),
normalModel(lmp, hsetup),
cohesionModel(lmp, hsetup),
tangentialModel(lmp, hsetup),
rollingModel(lmp, hsetup)
{
}
int64_t hashcode()
{ return STYLE_HASHCODE; }
inline void registerSettings(Settings & settings)
{
surfaceModel.registerSettings(settings);
normalModel.registerSettings(settings);
cohesionModel.registerSettings(settings);
tangentialModel.registerSettings(settings);
rollingModel.registerSettings(settings);
}
inline void connectToProperties(PropertyRegistry & registry)
{
surfaceModel.connectToProperties(registry);
normalModel.connectToProperties(registry);
cohesionModel.connectToProperties(registry);
tangentialModel.connectToProperties(registry);
rollingModel.connectToProperties(registry);
}
inline void beginPass(CollisionData & cdata, ForceData & i_forces, ForceData & j_forces)
{
surfaceModel.beginPass(cdata, i_forces, j_forces);
normalModel.beginPass(cdata, i_forces, j_forces);
cohesionModel.beginPass(cdata, i_forces, j_forces);
tangentialModel.beginPass(cdata, i_forces, j_forces);
rollingModel.beginPass(cdata, i_forces, j_forces);
}
inline void endPass(CollisionData & cdata, ForceData & i_forces, ForceData & j_forces)
{
rollingModel.endPass(cdata, i_forces, j_forces);
tangentialModel.endPass(cdata, i_forces, j_forces);
cohesionModel.endPass(cdata, i_forces, j_forces);
normalModel.endPass(cdata, i_forces, j_forces);
surfaceModel.endPass(cdata, i_forces, j_forces);
}
inline double stressStrainExponent()
{
return normalModel.stressStrainExponent();
}
inline void collision(CollisionData & cdata, ForceData & i_forces, ForceData & j_forces)
{
surfaceModel.collision(cdata, i_forces, j_forces);
normalModel.collision(cdata, i_forces, j_forces);
cohesionModel.collision(cdata, i_forces, j_forces);
tangentialModel.collision(cdata, i_forces, j_forces);
rollingModel.collision(cdata, i_forces, j_forces);
}
inline void noCollision(ContactData & cdata, ForceData & i_forces, ForceData & j_forces)
{
surfaceModel.noCollision(cdata, i_forces, j_forces);
normalModel.noCollision(cdata, i_forces, j_forces);
cohesionModel.noCollision(cdata, i_forces, j_forces);
tangentialModel.noCollision(cdata, i_forces, j_forces);
rollingModel.noCollision(cdata, i_forces, j_forces);
}
};
template<>
class CohesionModel<COHESION_OFF> : protected Pointers
{
public:
static const int MASK = 0;
CohesionModel(LAMMPS * lmp, IContactHistorySetup*) : Pointers(lmp) {}
void beginPass(CollisionData&, ForceData&, ForceData&){}
void endPass(CollisionData&, ForceData&, ForceData&){}
void connectToProperties(PropertyRegistry&){}
void registerSettings(Settings&){}
void collision(CollisionData&, ForceData&, ForceData&){}
void noCollision(ContactData&, ForceData&, ForceData&){}
};
template<>
class RollingModel<ROLLING_OFF> : protected Pointers
{
public:
static const int MASK = 0;
RollingModel(LAMMPS * lmp, IContactHistorySetup*) : Pointers(lmp) {}
void beginPass(CollisionData&, ForceData&, ForceData&){}
void endPass(CollisionData&, ForceData&, ForceData&){}
void connectToProperties(PropertyRegistry&){}
void registerSettings(Settings&){}
void collision(CollisionData&, ForceData&, ForceData&){}
void noCollision(ContactData&, ForceData&, ForceData&){}
};
class Factory {
typedef std::map<std::string, int> ModelTable;
ModelTable surface_models;
ModelTable normal_models;
ModelTable tangential_models;
ModelTable cohesion_models;
ModelTable rolling_models;
Factory();
Factory(const Factory &){}
public:
static Factory & instance();
static int64_t select(int & narg, char ** & args);
void addNormalModel(const std::string & name, int identifier);
void addTangentialModel(const std::string & name, int identifier);
void addCohesionModel(const std::string & name, int identifier);
void addRollingModel(const std::string & name, int identifier);
void addSurfaceModel(const std::string & name, int identifier);
private:
int64_t select_model(int & narg, char ** & args);
};
}
}
#endif /* CONTACT_MODELS_H_ */
|