aclocal.m4 | ●●●●● patch | view | raw | blame | history | |
src/Makefile.am | ●●●●● patch | view | raw | blame | history | |
src/general.h | ●●●●● patch | view | raw | blame | history | |
src/initial_distribution.c | ●●●●● patch | view | raw | blame | history | |
src/memory.c | ●●●●● patch | view | raw | blame | history | |
src/memory.h | ●●●●● patch | view | raw | blame | history |
aclocal.m4
@@ -1,4 +1,4 @@ # generated automatically by aclocal 1.11.6 -*- Autoconf -*- # generated automatically by aclocal 1.11.3 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, @@ -14,8 +14,8 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, [m4_warning([this file was generated for autoconf 2.68. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) @@ -38,7 +38,7 @@ [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.6], [], m4_if([$1], [1.11.3], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -54,7 +54,7 @@ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.6])dnl [AM_AUTOMAKE_VERSION([1.11.3])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) src/Makefile.am
@@ -1,17 +1,17 @@ trisurfdir=../ trisurf_PROGRAMS = trisurf trisurf_SOURCES = general.c vertex.c bond.c triangle.c cell.c vesicle.c initial_distribution.c io.c frame.c energy.c timestep.c vertexmove.c bondflip.c main.c trisurf_SOURCES = general.c vertex.c bond.c triangle.c cell.c vesicle.c initial_distribution.c io.c frame.c energy.c timestep.c vertexmove.c bondflip.c main.c memory.c #trisurf_LDFLAGS = -lm -lconfuse shdiscoverdir=../ shdiscover_PROGRAMS= shdiscover shdiscover_SOURCES= general.c vertex.c bond.c triangle.c cell.c vesicle.c initial_distribution.c io.c energy.c sh.c shdiscover.c shdiscover_SOURCES= general.c vertex.c bond.c triangle.c cell.c vesicle.c initial_distribution.c io.c energy.c sh.c shdiscover.c memory.c AM_CFLAGS = -Wall -Werror co_testdir=../ co_test_PROGRAMS=co_test co_test_SOURCES= general.c vertex.c bond.c triangle.c cell.c vesicle.c initial_distribution.c io.c energy.c sh.c co_test.c frame.c bondflip.c co_test_SOURCES= general.c vertex.c bond.c triangle.c cell.c vesicle.c initial_distribution.c io.c energy.c sh.c co_test.c frame.c bondflip.c memory.c spherical_trisurfdir=../ spherical_trisurf_PROGRAMS = spherical_trisurf spherical_trisurf_SOURCES = general.c vertex.c bond.c triangle.c cell.c vesicle.c initial_distribution.c io.c frame.c energy.c timestep.c vertexmove.c spherical_trisurf.c sh.c bondflip.c spherical_trisurf_SOURCES = general.c vertex.c bond.c triangle.c cell.c vesicle.c initial_distribution.c io.c frame.c energy.c timestep.c vertexmove.c spherical_trisurf.c sh.c bondflip.c memory.c spherical_trisurf_ffdir=../ spherical_trisurf_ff_PROGRAMS = spherical_trisurf_ff spherical_trisurf_ff_SOURCES = general.c vertex.c bond.c triangle.c cell.c vesicle.c initial_distribution.c io.c frame.c energy.c timestep.c vertexmove.c spherical_trisurf_ff.c sh.c bondflip.c spherical_trisurf_ff_SOURCES = general.c vertex.c bond.c triangle.c cell.c vesicle.c initial_distribution.c io.c frame.c energy.c timestep.c vertexmove.c spherical_trisurf_ff.c sh.c bondflip.c memory.c src/general.h
@@ -240,14 +240,40 @@ ts_spharm *sphHarmonics; } ts_vesicle; typedef struct { ts_uint vertex_no; ts_uint ncmax[3]; ts_vesicle *vesicle; ts_vertex_list *vlist; ts_bond_list *blist; ts_triangle_list *tlist; ts_cell_list *clist; ts_vertex **vtx_ptr; ts_vertex *vtx; ts_vertex *vtx_neighbours; ts_vertex **vtx_neighbours_ptr; ts_bond **vtx_neighbond; ts_triangle **tristar; ts_triangle **tria_ptr; ts_triangle *tria; ts_triangle **trianeigh; ts_bond **bond_ptr; ts_bond *bond; ts_cell **cell_ptr; ts_cell *cell; ts_vertex **cell_ocupancy; /* ts_spharm *sphHarmonics; */ } ts_memory; /* GLOBAL VARIABLES */ int quiet; /* ERROR CODES */ #define TS_ERR_MEM_ALLOC 1 /* FUNCTIONS */ /** Non-fatal error function handler: src/initial_distribution.c
@@ -9,14 +9,20 @@ #include "triangle.h" #include "initial_distribution.h" #include "energy.h" #include "memory.h" ts_vesicle *initial_distribution_dipyramid(ts_uint nshell, ts_uint ncmax1, ts_uint ncmax2, ts_uint ncmax3, ts_double stepsize){ ts_fprintf(stderr,"Starting initial_distribution on vesicle with %u shells!...\n",nshell); ts_bool retval; ts_uint no_vertices=5*nshell*nshell+2; ts_memory mem; mem.vertex_no=no_vertices; mem.ncmax[0]=ncmax1; mem.ncmax[1]=ncmax2; mem.ncmax[2]=ncmax3; init_memory_block(&mem); ts_vesicle *vesicle=init_vesicle(no_vertices,ncmax1,ncmax2,ncmax3,stepsize); //TODO: debugging only. Please remove ASAP! src/memory.c
New file @@ -0,0 +1,87 @@ #include<stdlib.h> #include<unistd.h> #include"general.h" #include"vesicle.h" #include "memory.h" ts_bool init_memory_block(ts_memory *mem){ /* calculate number of bonds, triangles */ ts_uint nbonds=3*(mem->vertex_no-2); ts_uint ntria=2*(mem->vertex_no-2); ts_uint ncells=mem->ncmax[0]*mem->ncmax[1]*mem->ncmax[2]; ts_uint memsize=sizeof(ts_vesicle)+ sizeof(ts_vertex_list)+ sizeof(ts_bond_list)+ sizeof(ts_triangle_list) + sizeof(ts_cell_list) + mem->vertex_no*(sizeof(ts_vertex)+sizeof(ts_vertex *)) + nbonds*(sizeof(ts_bond)+sizeof(ts_bond *))+ ntria*(sizeof(ts_triangle)+ sizeof(ts_triangle *))+ ncells*(sizeof(ts_cell)+ sizeof(ts_cell *))+ MAX_VTXNEIGH*mem->vertex_no*sizeof(ts_vertex *)+ MAX_TRISTAR*mem->vertex_no*sizeof(ts_triangle *)+ MAX_VTXNEIGH*mem->vertex_no*sizeof(ts_bond *)+ 3*ntria*sizeof(ts_triangle *)+ MAX_CELL_OCCUPANCY*ncells*sizeof(ts_vertex *); /* here add size of memory for additional structures!!! */ printf("The page size for this system is %ld bytes.\n", sysconf(_SC_PAGESIZE)); /* _SC_PAGE_SIZE is OK too. */ printf("We need to initialize %d B of memory to hold info about vesicle\n",memsize); void *ptr=calloc(1,memsize); if(ptr==NULL) fatal("Couldn't initialize memory block in memory.c", TS_ERR_MEM_ALLOC); /*initialize pointers */ void *rptr=ptr; //Vesicle and basic lists mem->vesicle=(ts_vesicle *)rptr; rptr+=sizeof(ts_vesicle); mem->vlist=(ts_vertex_list *)rptr; rptr+=sizeof(ts_vertex_list); mem->blist=(ts_bond_list *)rptr; rptr+=sizeof(ts_bond_list); mem->tlist=(ts_triangle_list *)rptr; rptr+=sizeof(ts_triangle_list); mem->clist=(ts_cell_list *)rptr; rptr+=sizeof(ts_cell_list); //Vertex related memory mem->vtx_ptr=(ts_vertex **)rptr; rptr+=mem->vertex_no*sizeof(ts_vertex *); mem->vtx=(ts_vertex *)rptr; rptr+=mem->vertex_no*sizeof(ts_vertex); mem->vtx_neighbours_ptr=(ts_vertex **)rptr; rptr+=mem->vertex_no*MAX_VTXNEIGH*sizeof(ts_vertex *); mem->tristar=(ts_triangle **)rptr; rptr+=mem->vertex_no*MAX_TRISTAR*sizeof(ts_triangle *); mem->vtx_neighbond=(ts_bond **)rptr; rptr+=mem->vertex_no*MAX_VTXNEIGH*sizeof(ts_bond *); //Bond related memory mem->bond_ptr=(ts_bond **)rptr; rptr+=nbonds*sizeof(ts_bond *); mem->bond=(ts_bond *)rptr; rptr+=nbonds*sizeof(ts_bond); //Triangle related memory mem->tria_ptr=(ts_triangle **)rptr; rptr+=ntria*sizeof(ts_triangle *); mem->tria=(ts_triangle *)rptr; rptr+=ntria*sizeof(ts_triangle); mem->trianeigh=(ts_triangle **)rptr; rptr+=ntria*3*sizeof(ts_triangle *); //Cell related memory mem->cell_ptr=(ts_cell **)rptr; rptr+=ncells*sizeof(ts_cell *); mem->cell=(ts_cell *)rptr; rptr+=ncells*sizeof(ts_cell); mem->cell_ocupancy=(ts_vertex **)rptr; rptr+= MAX_CELL_OCCUPANCY*ncells*sizeof(ts_vertex *); printf("Ptr diff in b=%ld\n",(rptr-ptr)); return TS_SUCCESS; } src/memory.h
New file @@ -0,0 +1,9 @@ #ifndef _h_memory #define _h_memory #include "general.h" #define MAX_TRISTAR 8 #define MAX_VTXNEIGH 7 #define MAX_CELL_OCCUPANCY 8 ts_bool init_memory_block(ts_memory *mem); #endif