Skip to content

Commit

Permalink
getting closer I hope
Browse files Browse the repository at this point in the history
  • Loading branch information
glyg committed Jan 8, 2024
1 parent e62491c commit 367edd6
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 54 deletions.
44 changes: 19 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,34 @@ set(PYBIND11_FINDPYTHON ON)
find_package(pybind11 CONFIG REQUIRED)


##############################################################################

# Some screen output
message(STATUS "OS detected: ${CMAKE_SYSTEM_NAME}")
message(STATUS "CXX Compiler detected: ${CMAKE_CXX_COMPILER_ID}")
message(STATUS "CMake additional search path for libraries: ${CMAKE_LIBRARY_PATH}")

# CGAL and its components
find_package(CGAL)
message(STATUS "CGAL version: ${CGAL_VERSION}")

# # CGAL and its components
# find_package(CGAL)
# message(STATUS "CGAL version: ${CGAL_VERSION}")

# if (NOT CGAL_FOUND)
# message(STATUS "This project requires the CGAL library, and will not be compiled.")
# return()
# endif()

if (NOT CGAL_FOUND)
message(STATUS "This project requires the CGAL library, and will not be compiled.")
return()
endif()

# include helper file
include( ${CGAL_USE_FILE})
message(STATUS "CGAL_USE_FILE: ${CGAL_USE_FILE}")

# # include helper file
# include( ${CGAL_USE_FILE})
# message(STATUS "CGAL_USE_FILE: ${CGAL_USE_FILE}")
set (CPP_SRC "src/tyssue_cpp/")



pybind11_add_module(tyssue_cpp MODULE src/main.cpp)
# This is needed
pybind11_add_module(tyssue_cpp MODULE "src/main.cpp" )
install(TARGETS tyssue_cpp DESTINATION ${SKBUILD_PROJECT_NAME})

# set (COLLISION_SRCE "src/tyssue/collisions/cpp")
# pybind11_add_module(c_collisions SHARED "${COLLISION_SRCE}/c_collisions.cpp" )
# install(TARGETS c_collisions DESTINATION ${COLLISION_SRCE})
# message(STATUS "installed c_collisions")

pybind11_add_module(_mesh_generation MODULE "${CPP_SRC}/mesh_generation.cpp" )
install(TARGETS _mesh_generation DESTINATION ${SKBUILD_PROJECT_NAME})

# set (GENERATION_SRCE "src/tyssue/generation/cpp")
# pybind11_add_module(mesh_generation SHARED "${GENERATION_SRCE}/mesh_generation.cpp" )
# install(TARGETS mesh_generation DESTINATION ${GENERATION_SRCE})
set (COLLISION_SRCE "src/tyssue_cpp")
pybind11_add_module(_collisions SHARED "${CPP_SRC}/c_collisions.cpp" )
install(TARGETS _collisions DESTINATION ${SKBUILD_PROJECT_NAME})
message(STATUS "installed c_collisions")
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ Changelog = "https://githib.com/damcb/tyssue/releases"

[tool.scikit-build]
minimum-version = "0.4"
build-dir = "build/{wheel_tag}"
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"

sdist.exclude = [".github"]
Expand Down
6 changes: 0 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
#include <pybind11/pybind11.h>

namespace py = pybind11;
// include "tyssue_cpp/c_collsions.cpp"
// include "tyssue_cpp/mesh_generation.cpp"



namespace py = pybind11;

size_t free_function() {
Expand Down
4 changes: 2 additions & 2 deletions src/tyssue/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE

__version__ = version = '0.9.1.dev122+gebbdeb7.d20240107'
__version_tuple__ = version_tuple = (0, 9, 1, 'dev122', 'gebbdeb7.d20240107')
__version__ = version = '0.9.1.dev123+ge62491c.d20240108'
__version_tuple__ = version_tuple = (0, 9, 1, 'dev123', 'ge62491c.d20240108')
40 changes: 20 additions & 20 deletions src/tyssue/generation/shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
from ..topology import type1_transition
from .from_voronoi import from_3d_voronoi

try:
from .cpp import mesh_generation
except ImportError:
print(
"CGAL-based mesh generation utilities not found, you may need to install"
" CGAL and build from source"
)
mesh_generation = None
from .._mesh_generation import make_spherical

# except ImportError:
# print(
# "CGAL-based mesh generation utilities not found, you may need to install"
# " CGAL and build from source"
# )
# make_sphertical = None

from ..utils import single_cell, swap_apico_basal
from .modifiers import extrude
Expand Down Expand Up @@ -182,6 +182,8 @@ def generate_ring(Nf, R_in, R_out, R_vit=None, apical="in"):
"""
Flat lateral 2D sheet
"""


def generate_lateral_tissue(Nf, length, height):
"""
Generate a 2D lateral tyssue object
Expand All @@ -208,26 +210,23 @@ def generate_lateral_tissue(Nf, length, height):
vert_df = pd.DataFrame(
index=pd.Index(range(Nv + 2), name="vert"),
columns=specs["vert"].keys(),
dtype=float
dtype=float,
)

edge_df = pd.DataFrame(
index=pd.Index(range(Ne), name="edge"),
columns=specs["edge"].keys(),
dtype=float
dtype=float,
)

face_df = pd.DataFrame(
index=pd.Index(range(Nf), name="face"),
columns=specs["face"].keys(),
dtype=float
dtype=float,
)

inner_edges = np.array(
[
[f0, v0, v1 + 1]
for f0, v0, v1 in zip(range(Nf), range(Nf), range(Nf))
]
[[f0, v0, v1 + 1] for f0, v0, v1 in zip(range(Nf), range(Nf), range(Nf))]
)

outer_edges = np.zeros_like(inner_edges)
Expand All @@ -253,7 +252,9 @@ def generate_lateral_tissue(Nf, length, height):
# Setting vertices position
vert_df.loc[range(Nf + 1), "x"] = [length / Nf * i for i in range(Nf + 1)]
vert_df.loc[range(Nf + 1), "y"] = 0
vert_df.loc[range(Nf + 1, 2 * (Nf + 1)), "x"] = [length / Nf * i for i in range(Nf + 1)]
vert_df.loc[range(Nf + 1, 2 * (Nf + 1)), "x"] = [
length / Nf * i for i in range(Nf + 1)
]
vert_df.loc[range(Nf + 1, 2 * (Nf + 1)), "y"] = height

vert_df["segment"] = "basal"
Expand All @@ -263,8 +264,8 @@ def generate_lateral_tissue(Nf, length, height):

edge_df.loc[range(2 * Nf, 4 * Nf), "segment"] = "lateral"

vert_df['is_active'] = 1
face_df['is_alive'] = 1
vert_df["is_active"] = 1
face_df["is_alive"] = 1

datasets = {"vert": vert_df, "edge": edge_df, "face": face_df}

Expand Down Expand Up @@ -384,7 +385,7 @@ def spherical_sheet(radius, Nf, Lloyd_relax=False, **kwargs):
the given number of cells
"""

centers = np.array(mesh_generation.make_spherical(Nf))
centers = np.array(make_spherical(Nf))
eptm = sheet_from_cell_centers(centers, **kwargs)

rhos = (eptm.vert_df[eptm.coords] ** 2).sum(axis=1).mean()
Expand Down Expand Up @@ -542,7 +543,6 @@ def Lloyd_relaxation(sheet, geom, steps=10, coords=None, update_method=None):


def update_on_sphere(sheet):

update_spherical(sheet)

thetas = sheet.face_df["theta"].to_numpy()
Expand Down

0 comments on commit 367edd6

Please sign in to comment.