Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"files.associations": {
"algorithm": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"cctype": "cpp",
"charconv": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"concepts": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"exception": "cpp",
"format": "cpp",
"forward_list": "cpp",
"functional": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"list": "cpp",
"locale": "cpp",
"map": "cpp",
"memory": "cpp",
"new": "cpp",
"optional": "cpp",
"ostream": "cpp",
"random": "cpp",
"ratio": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"utility": "cpp",
"vector": "cpp",
"xfacet": "cpp",
"xhash": "cpp",
"xiosbase": "cpp",
"xlocale": "cpp",
"xlocbuf": "cpp",
"xlocinfo": "cpp",
"xlocmes": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xmemory": "cpp",
"xstddef": "cpp",
"xstring": "cpp",
"xtr1common": "cpp",
"xtree": "cpp",
"xutility": "cpp"
},
"C_Cpp.errorSquiggles": "Disabled"
}
5 changes: 5 additions & 0 deletions CellModeller/Biophysics/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"files.associations": {
"vector": "cpp"
}
}
1 change: 1 addition & 0 deletions CellModeller/Biophysics/BacterialModels/CLBacterium.cl
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ float4 quat_rot(float4 q, float4 v) {
// axis -- axis about which to rotate
// angle -- amount to rotate (radians)
// v -- the vector to rotate

float4 rot(float4 axis, float angle, float4 v) {
float4 q = axis*sin(angle/2.f);
q.w = cos(angle/2.f);
Expand Down
11 changes: 7 additions & 4 deletions CellModeller/Biophysics/BacterialModels/CLBacterium.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ def init_kernels(self):
reduce_expr="a+b", map_expr="dot(x[i].s0123,y[i].s0123)+dot(x[i].s4567,y[i].s4567)",
arguments="__global float8 *x, __global float8 *y")

# Add a force along the length dimension only
self.add_force = ElementwiseKernel(self.context,
"float8 *pos, const float mag, const float *force",
"pos[i].s6 = pos[i].s6 + mag*force[i]", "add_force")

def init_data(self):
"""Set up the data OpenCL will store on the device."""
Expand Down Expand Up @@ -231,6 +235,7 @@ def init_data(self):
self.cell_dlens_dev = cl_array.zeros(self.queue, cell_geom, numpy.float32)
self.cell_target_dlens_dev = cl_array.zeros(self.queue, cell_geom, numpy.float32)
self.cell_growth_rates = numpy.zeros(cell_geom, numpy.float32)
self.cell_growth_rates_dev = cl_array.zeros(self.queue, cell_geom, numpy.float32)

# cell geometry calculated from l and r
self.cell_areas_dev = cl_array.zeros(self.queue, cell_geom, numpy.float32)
Expand Down Expand Up @@ -449,6 +454,7 @@ def set_cells(self):
self.cell_dlens_dev[0:self.n_cells].set(self.cell_dlens[0:self.n_cells])
self.cell_dcenters_dev[0:self.n_cells].set(self.cell_dcenters[0:self.n_cells])
self.cell_dangs_dev[0:self.n_cells].set(self.cell_dangs[0:self.n_cells])
self.cell_growth_rates_dev[0:self.n_cells].set(self.cell_growth_rates[0:self.n_cells])

def set_planes(self):
"""Copy plane pts, norms, and coeffs to the device from local."""
Expand Down Expand Up @@ -574,8 +580,6 @@ def step(self, dt):

def sub_tick_init(self, dt):
# set target dlens (taken from growth rates set by updateCellStates)
#self.cell_target_dlens_dev.set(dt*self.cell_growth_rates)
#self.cell_dlens_dev.set(dt*self.cell_dlens)
self.cell_dlens_dev[0:self.n_cells].set(dt*self.cell_growth_rates[0:self.n_cells])

# redefine gridding based on the range of cell positions
Expand Down Expand Up @@ -616,7 +620,7 @@ def sub_tick(self, dt):
self.sub_tick_i += 1
alpha = 10**(self.sub_tick_i)
new_cts = self.n_cts - old_n_cts
if (new_cts>0 or self.sub_tick_i==0) and self.sub_tick_i<self.max_substeps:
if (new_cts>0 or self.sub_tick_i==1) and self.sub_tick_i<self.max_substeps:
self.build_matrix() # Calculate entries of the matrix
#print "max cell contacts = %i"%cl_array.max(self.cell_n_cts_dev).get()
self.CGSSolve(dt, alpha) # invert MTMx to find deltap
Expand Down Expand Up @@ -976,7 +980,6 @@ def CGSSolve(self, dt, alpha, substep=False):
self.ct_reldists_dev.data,
self.rhs_dev.data).wait()


# res = b-Ax
self.calculate_Ax(self.BTBx_dev, self.deltap_dev, dt, alpha)
self.vsub(self.res_dev[0:self.n_cells], self.rhs_dev[0:self.n_cells], self.BTBx_dev[0:self.n_cells])
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading