#include "plugins.h"
|
#include <stdlib.h>
|
#include "general.h"
|
#include "vertex.h"
|
#include "cell.h"
|
char plugin_name[] = "Default hard constraints for vertex move";
|
char plugin_description[]= "Checks proximity with neighbors, vertices in neighboring cells and with foreign vertices that may be in vicinity";
|
char plugin_author[] = "SAMO PENIC";
|
|
ts_plugin_details *init (){
|
ts_plugin_details *details=(ts_plugin_details *)calloc(1,sizeof(ts_plugin_details));
|
details->name = plugin_name;
|
return details;
|
}
|
|
ts_bool vm_hard_constraint(ts_vesicle *vesicle, ts_vertex *vtx, ts_vertex *ovtx){
|
ts_uint i;
|
ts_uint cellidx;
|
ts_double dist;
|
ts_bool retval;
|
//distance with neighbours check
|
for(i=0;i<vtx->neigh_no;i++){
|
dist=vtx_distance_sq(vtx,vtx->neigh[i]);
|
if(dist<1.0 || dist>vesicle->dmax) {
|
return TS_FAIL;
|
}
|
}
|
// Distance with grafted poly-vertex check:
|
if(vtx->grafted_poly!=NULL){
|
dist=vtx_distance_sq(vtx,vtx->grafted_poly->vlist->vtx[0]);
|
if(dist<1.0 || dist>vesicle->dmax) {
|
return TS_FAIL;
|
}
|
}
|
|
//self avoidance check with distant vertices
|
cellidx=vertex_self_avoidance(vesicle, vtx);
|
//check occupation number
|
retval=cell_occupation_number_and_internal_proximity(vesicle->clist,cellidx,vtx);
|
if(retval==TS_FAIL){
|
return TS_FAIL;
|
}
|
|
return TS_SUCCESS;
|
}
|