1 |
< |
#include <cstdlib> |
2 |
< |
#include <cstdio> |
1 |
> |
#include <stdlib.h> |
2 |
> |
#include <stdio.h> |
3 |
> |
#include <string.h> |
4 |
|
|
5 |
|
#include "MakeStamps.hpp" |
6 |
|
#include "MoleculeStamp.hpp" |
7 |
+ |
#include "RigidBodyStamp.hpp" |
8 |
|
#include "simError.h" |
9 |
|
#ifdef IS_MPI |
10 |
|
#include "mpiBASS.h" |
91 |
|
MakeStamps::MakeStamps(){ |
92 |
|
|
93 |
|
int i; |
94 |
+ |
|
95 |
+ |
hash_size = 47; |
96 |
+ |
hash_shift = 4; |
97 |
|
|
98 |
|
my_mols = new LinkedMolStamp*[hash_size]; |
99 |
|
for( i=0; i<hash_size; i++ ){ |
213 |
|
return 1; |
214 |
|
} |
215 |
|
|
216 |
< |
int MakeStamps::newAtom( event* the_event ){ |
216 |
> |
int MakeStamps::newRigidBody( event* the_event ){ |
217 |
|
|
218 |
+ |
current_rigidbody = new RigidBodyStamp; |
219 |
+ |
|
220 |
+ |
the_event->err_msg = current_mol->addRigidBody( current_rigidbody, |
221 |
+ |
the_event->evt.blk_index ); |
222 |
+ |
if( the_event->err_msg != NULL ) return 0; |
223 |
+ |
return 1; |
224 |
+ |
} |
225 |
+ |
|
226 |
+ |
int MakeStamps::rigidBodyPosition( event* the_event ){ |
227 |
+ |
|
228 |
+ |
current_rigidbody->setPosition( the_event->evt.pos.x, |
229 |
+ |
the_event->evt.pos.y, |
230 |
+ |
the_event->evt.pos.z ); |
231 |
+ |
return 1; |
232 |
+ |
} |
233 |
+ |
|
234 |
+ |
|
235 |
+ |
int MakeStamps::rigidBodyOrientation( event* the_event ){ |
236 |
+ |
|
237 |
+ |
current_rigidbody->setOrientation( the_event->evt.ornt.x, |
238 |
+ |
the_event->evt.ornt.y, |
239 |
+ |
the_event->evt.ornt.z ); |
240 |
+ |
return 1; |
241 |
+ |
} |
242 |
+ |
|
243 |
+ |
int MakeStamps::rigidBodyAssign( event* the_event ){ |
244 |
+ |
|
245 |
+ |
switch( the_event->evt.asmt.asmt_type ){ |
246 |
+ |
|
247 |
+ |
case STRING: |
248 |
+ |
the_event->err_msg = |
249 |
+ |
current_rigidbody->assignString( the_event->evt.asmt.lhs, |
250 |
+ |
the_event->evt.asmt.rhs.sval ); |
251 |
+ |
if( the_event->err_msg != NULL ) return 0; |
252 |
+ |
return 1; |
253 |
+ |
break; |
254 |
+ |
|
255 |
+ |
case DOUBLE: |
256 |
+ |
the_event->err_msg = |
257 |
+ |
current_rigidbody->assignDouble( the_event->evt.asmt.lhs, |
258 |
+ |
the_event->evt.asmt.rhs.dval ); |
259 |
+ |
if( the_event->err_msg != NULL ) return 0; |
260 |
+ |
return 1; |
261 |
+ |
break; |
262 |
+ |
|
263 |
+ |
case INT: |
264 |
+ |
the_event->err_msg = |
265 |
+ |
current_rigidbody->assignInt( the_event->evt.asmt.lhs, |
266 |
+ |
the_event->evt.asmt.rhs.ival ); |
267 |
+ |
if( the_event->err_msg != NULL ) return 0; |
268 |
+ |
return 1; |
269 |
+ |
break; |
270 |
+ |
|
271 |
+ |
default: |
272 |
+ |
the_event->err_msg = strdup( "MakeStamp error. Invalid rigidBody" |
273 |
+ |
" assignment type" ); |
274 |
+ |
return 0; |
275 |
+ |
break; |
276 |
+ |
} |
277 |
+ |
return 0; |
278 |
+ |
} |
279 |
+ |
|
280 |
+ |
int MakeStamps::rigidBodyEnd( event* the_event ){ |
281 |
+ |
|
282 |
+ |
the_event->err_msg = current_rigidbody->checkMe(); |
283 |
+ |
if( the_event->err_msg != NULL ) return 0; |
284 |
+ |
|
285 |
+ |
return 1; |
286 |
+ |
} |
287 |
+ |
|
288 |
+ |
int MakeStamps::newAtomInMolecule( event* the_event ){ |
289 |
+ |
|
290 |
|
current_atom = new AtomStamp; |
291 |
|
|
292 |
|
the_event->err_msg = current_mol->addAtom( current_atom, |
293 |
|
the_event->evt.blk_index ); |
294 |
+ |
|
295 |
|
if( the_event->err_msg != NULL ) return 0; |
296 |
|
return 1; |
297 |
|
} |
298 |
|
|
299 |
+ |
int MakeStamps::newAtomInRigidBody( event* the_event ){ |
300 |
+ |
|
301 |
+ |
current_atom = new AtomStamp; |
302 |
+ |
|
303 |
+ |
the_event->err_msg = current_rigidbody->addAtom( current_atom, |
304 |
+ |
the_event->evt.blk_index ); |
305 |
+ |
|
306 |
+ |
if( the_event->err_msg != NULL ) return 0; |
307 |
+ |
return 1; |
308 |
+ |
} |
309 |
+ |
|
310 |
|
int MakeStamps::atomPosition( event* the_event ){ |
311 |
|
|
312 |
|
current_atom->setPosition( the_event->evt.pos.x, |