136
139
ISVALID_PTR(m_pLatticeMaster) ;
137
getLatticeMaster().addBondedTriMeshIG(name,meshname,k,break_dist,build,buildparams);
140
addBondedTriMeshIG(name,meshname,k,break_dist,build,buildparams);
138
141
SParserAccess::Interface()->SetAllValues() ;
139
142
return OpValue(1L) ;
146
add a group of bonded triangle mesh (surface) to particle interactions
148
\param name the name of the itneraction group
149
\param meshname the name of the mesh
150
\param k spring constant
151
\param r_break (relative) breaking distance
152
\param buildtype the way to initially build the IG
153
\param buildparam the parameters for building the IG
155
void addBondedTriMeshIG(const std::string& name,
156
const std::string& meshname,
159
const std::string& buildtype,
160
const std::list<OpValue> &buildparams)
162
console.XDebug() << "PF_AddBondedTriMeshIG::addBondedTriMeshIG\n";
164
BTriMeshIP triMeshPrms;
166
triMeshPrms.setName(name);
167
triMeshPrms.setMeshName(meshname.c_str());
169
triMeshPrms.brk = r_break;
171
if (buildtype == TriMeshTagBuildPrms().getTypeString()) {
172
console.XDebug() << "BuildByTag\n";
173
// extract build parameters
174
TriMeshTagBuildPrms buildPrms;
175
list<OpValue>::const_iterator iter=buildparams.begin();
176
buildPrms.m_tag = int(iter->Content.l); iter++; // tag
177
buildPrms.m_mask = int(iter->Content.l); // mask
178
getLatticeMaster().addBondedTriMeshIG(triMeshPrms, buildPrms);
179
} else if (buildtype == TriMeshGapBuildPrms().getTypeString()) {
180
list<OpValue>::const_iterator iter=buildparams.begin();
181
TriMeshGapBuildPrms buildPrms;
182
buildPrms.m_maxGap = iter->Content.d; // max. gap
183
getLatticeMaster().addBondedTriMeshIG(triMeshPrms, buildPrms);
185
throw std::runtime_error(std::string("Unknown BTriMeshInteraction build type: ")+buildtype);
187
console.XDebug() << "end PF_AddBondedTriMeshIG::addBondedTriMeshIG\n";
205
253
params.push_back(OV);
208
getLatticeMaster().addPairIG(type,name,params);
256
addPairIG(type, name, params);
209
257
SParserAccess::Interface()->SetAllValues() ;
210
258
return OpValue(1L) ;
261
void addPairIG(const std::string &type, const std::string &name, const list<OpValue> ¶ms)
263
console.XDebug() << "PF_AddPIG::addPairIG\n";
265
list<OpValue>::const_iterator iter=params.begin();
266
if (type == "Elastic") {
269
prms.m_k = iter->Content.d;
270
getLatticeMaster().addPairIG(prms);
271
} else if (type == "Friction") {
274
prms.k = iter->Content.d; iter++; // k
275
prms.mu = iter->Content.d; iter++; // mu
276
prms.k_s = iter->Content.d; iter++; // k_s
277
prms.dt = iter->Content.d; // dt
278
getLatticeMaster().addPairIG(prms);
279
} else if(type=="AdhesiveFriction"){
280
CAdhesiveFrictionIGP prms;
282
prms.k = iter->Content.d; iter++; // k
283
prms.mu = iter->Content.d; iter++; // mu
284
prms.k_s = iter->Content.d; iter++; // k_s
285
prms.dt = iter->Content.d; iter++; // dt
286
prms.r_cut = iter->Content.d; // r_cut
287
getLatticeMaster().addPairIG(prms);
288
} else if (type=="FractalFriction") {
289
FractalFrictionIGP prms;
291
prms.k = iter->Content.d; iter++; // k
292
prms.mu_0 = iter->Content.d; iter++; // mu_0
293
prms.k_s = iter->Content.d; iter++; // k_s
294
prms.dt = iter->Content.d; iter++; // dt
295
prms.x0 = iter->Content.d; iter++; // x0
296
prms.y0 = iter->Content.d; iter++; // y0
297
prms.dx = iter->Content.d; iter++; // dx
298
prms.dy = iter->Content.d; iter++; // dy
299
prms.nx = iter->Content.l; iter++;
300
prms.ny = iter->Content.l;
301
prms.mu = boost::shared_ptr<double>(new double[prms.nx*prms.ny]);
302
// read coeff file and put it into buffer
303
string ffname=string("Data/test1.frac"); //iter++;
304
console.XDebug() << "frac file: " << ffname << "\n";
305
std::ifstream infile(ffname.c_str());
306
for(int i = 0; i < (prms.nx*prms.ny); i++) {
309
console.XDebug() << i << " : " << mu << "\n";
310
(prms.mu.get())[i] = mu;
313
getLatticeMaster().addPairIG(prms);
315
console.Error()<<"trying to add PIG of unknown type\n";
317
console.XDebug()<<"end PF_AddPIG::addPairIG\n";
243
350
params.push_back(OV);
246
getLatticeMaster().addTriMeshIG(type,name,meshname,params);
353
addTriMeshIG(type,name,meshname,params);
247
354
SParserAccess::Interface()->SetAllValues() ;
248
355
return OpValue(1L) ;
358
void addTriMeshIG(const std::string &type, const std::string &name, const std::string &meshname, const list<OpValue> ¶ms)
360
console.XDebug() << "begin PF_AddTMIG::addTriMeshIG\n";
362
if (type ==" Elastic") {
363
console.XDebug() << "TriMeshIG is elastic\n";
365
list<OpValue>::const_iterator iter=params.begin();
367
prms.k = iter->Content.d; // k
368
getLatticeMaster().addTriMeshIG(prms);
370
throw std::runtime_error(std::string("Unknown TriMesh interaction type: ")+type);
373
console.XDebug() << "end CLatticeMaster::addTriMeshIG\n";
322
447
params.push_back(OV);
325
getLatticeMaster().addSingleIG(type,name,params);
450
addSingleIG(type,name,params);
326
451
SParserAccess::Interface()->SetAllValues() ;
327
452
return OpValue(1L) ;
455
void addSingleIG(const string& type, const string& name, list<OpValue> params)
457
console.XDebug()<<"PF_AddSIG::addSingleIG\n";
459
if(type == "Gravity"){
461
list<OpValue>::iterator iter=params.begin();
462
const double x = iter->Content.d;
464
const double y = iter->Content.d;
466
const double z = iter->Content.d;
468
getLatticeMaster().addSingleIG(esys::lsm::GravityIGP(name, Vec3(x, y, z)));
470
throw std::runtime_error(
471
std::string("Unknown body force type: ")
476
console.XDebug()<<"end PF_AddSIG::addSingleIG\n";
760
909
params.push_back(OV);
763
getLatticeMaster().addDamping(type,params);
912
addDamping(type, params);
764
913
SParserAccess::Interface()->SetAllValues() ;
765
914
return OpValue(1L) ;
918
Add damping to a lattice. Send parameters to slaves
920
void addDamping(const string& type, const list<OpValue> ¶ms)
922
console.XDebug() << "PF_AddDamping::addDamping\n";
924
if (type == "Damping") {
926
list<OpValue>::const_iterator iter=params.begin();
928
igp.setVRef(Vec3(0.0,0.0,0.0));
929
igp.setVisc(iter->Content.d);
930
console.XDebug()<< "visc : " << iter->Content.d;
932
igp.setTimeStep(iter->Content.d);
933
console.XDebug()<< "dt : " << iter->Content.d;
935
igp.setMaxIter(iter->Content.l);
936
getLatticeMaster().addDamping(igp);
938
console.Error()<<"trying to add Damping of unknown type\n";
940
console.XDebug()<<"end PF_AddDamping::addDamping\n";
1322
1498
params.push_back(OV);
1325
getLatticeMaster().addRotPairIG(type,name,params);
1501
addRotPairIG(type,name,params);
1326
1502
console.XDebug() << "after TheLatticeMaster->addRotPairIG\n";
1327
1503
SParserAccess::Interface()->SetAllValues() ;
1328
1504
console.XDebug() << "##\n";
1329
1505
return OpValue(1L) ;
1508
void addRotPairIG(const string& type, const string& name, const list<OpValue> ¶ms)
1510
console.XDebug() << "PF_AddRotPIG::addRotPairIG\n";
1512
if (type == "RotElastic") {
1513
console.Debug()<<"adding Rotelastic PIG\n";
1514
console.XDebug()<< "name of the PIG is : " << name.c_str() << "\n";
1516
CRotElasticIGP prms;
1517
list<OpValue>::const_iterator iter=params.begin();
1519
prms.m_kr = iter->Content.d; // k
1520
getLatticeMaster().addPairIG(prms);
1521
} else if (type == "RotFriction") {
1522
console.Debug()<<"adding friction PIG\n";
1523
console.XDebug()<< "name of the PIG is : " << name.c_str() << "\n";
1524
CRotFrictionIGP prms;
1525
list<OpValue>::const_iterator iter=params.begin();
1527
prms.k = iter->Content.d; iter++; // k
1528
prms.mu_s = iter->Content.d; iter++; // mu_s
1529
prms.mu_d = iter->Content.d; iter++; // mu_d
1530
prms.k_s = iter->Content.d; iter++; // k_s
1531
prms.dt = iter->Content.d; // dt
1532
getLatticeMaster().addPairIG(prms);
1534
console.Error()<<"trying to add PIG of unknown type\n";
1536
console.XDebug()<<"end PF_AddRotPIG::addRotPairIG\n";