diff --git a/src/bindings/c/geometry.c b/src/bindings/c/geometry.c index a92d29b4..66d33c23 100644 --- a/src/bindings/c/geometry.c +++ b/src/bindings/c/geometry.c @@ -23,6 +23,8 @@ void define_rad_from_geom_c(const char *order_system, int *order_system_len, dou const char *group_type, int *group_type_len, const char *group_options, int *group_options_len); void element_connectivity_1d_c(void); void evaluate_ordering_c(void); +extern void offset_1d_c(double *offset_x, double *offset_y, double *offset_z); +extern void scale_1d_c(double *scale_x, double *scale_y, double *scale_z); void volume_of_mesh_c(double *volume_model, double *volume_tree); void write_elem_geometry_2d_c(const char *ELEMFILE, int *filename_len); void write_geo_file_c(int *ntype, const char *GEOFILE, int *filename_len); @@ -140,6 +142,16 @@ void evaluate_ordering() evaluate_ordering_c(); } +void offset_1d(double offset_x, double offset_y, double offset_z) +{ + offset_1d_c(&offset_x, &offset_y, &offset_z); +} + +void scale_1d(double scale_x, double scale_y, double scale_z) +{ + scale_1d_c(&scale_x, &scale_y, &scale_z); +} + void volume_of_mesh(double *volume_model, double *volume_tree) { volume_of_mesh_c(volume_model, volume_tree); diff --git a/src/bindings/c/geometry.f90 b/src/bindings/c/geometry.f90 index 411da8ae..170cbbbf 100644 --- a/src/bindings/c/geometry.f90 +++ b/src/bindings/c/geometry.f90 @@ -211,6 +211,36 @@ subroutine make_2d_vessel_from_1d_c(elemlist, elemlist_len) bind(C, name="make_2 end subroutine make_2d_vessel_from_1d_c +! +!################################################################################### +! + + subroutine offset_1d_c(offset_x, offset_y, offset_z) bind(C, name="offset_1d_c") + use arrays, only: dp + use geometry, only: offset_1d + implicit none + + real(dp),intent(in) :: offset_x, offset_y, offset_z + + call offset_1d(offset_x, offset_y, offset_z) + + end subroutine offset_1d_c + +! +!################################################################################### +! + + subroutine scale_1d_c(scale_x, scale_y, scale_z) bind(C, name="scale_1d_c") + use arrays, only: dp + use geometry, only: scale_1d + implicit none + + real(dp),intent(in) :: scale_x, scale_y, scale_z + + call scale_1d(scale_x, scale_y, scale_z) + + end subroutine scale_1d_c + ! !################################################################################### ! diff --git a/src/bindings/c/geometry.h b/src/bindings/c/geometry.h index 21b010ab..91cc5795 100644 --- a/src/bindings/c/geometry.h +++ b/src/bindings/c/geometry.h @@ -23,6 +23,8 @@ SHO_PUBLIC void define_rad_from_geom(const char *ORDER_SYSTEM, double CONTROL_PA double START_RAD, const char *GROUP_TYPE, const char *GROUP_OPTIONS); SHO_PUBLIC void element_connectivity_1d(); SHO_PUBLIC void evaluate_ordering(); +SHO_PUBLIC void offset_1d(double offset_x, double offset_y, double offset_z); +SHO_PUBLIC void scale_1d(double scale_x, double scale_y, double scale_z); SHO_PUBLIC void volume_of_mesh(double *volume_model, double *volume_tree); SHO_PUBLIC void write_elem_geometry_2d(const char *ELEMFILE); SHO_PUBLIC void write_geo_file(int ntype, const char *GEOFILE); diff --git a/src/lib/geometry.f90 b/src/lib/geometry.f90 index a07bf1ab..cb44f9fb 100644 --- a/src/lib/geometry.f90 +++ b/src/lib/geometry.f90 @@ -47,7 +47,9 @@ module geometry public import_ply_triangles public make_data_grid public make_2d_vessel_from_1d + public offset_1d public reallocate_node_elem_arrays + public scale_1d public set_initial_volume public triangles_from_surface public volume_of_mesh @@ -3576,6 +3578,29 @@ subroutine geo_node_offset(node_xyz_offset) end subroutine geo_node_offset +!!!############################################################################# + + subroutine offset_1d(offset_x, offset_y, offset_z) + !*offset_1d:* offset the 1D tree by the given x,y,z offset values + + real(dp),intent(in) :: offset_x, offset_y, offset_z + + character(len=60) :: sub_name + + ! -------------------------------------------------------------------------- + + sub_name = 'offset_1d' + call enter_exit(sub_name,1) + + node_xyz(1,1:num_nodes) = node_xyz(1,1:num_nodes) + offset_x + node_xyz(2,1:num_nodes) = node_xyz(2,1:num_nodes) + offset_y + node_xyz(3,1:num_nodes) = node_xyz(3,1:num_nodes) + offset_z + + call enter_exit(sub_name,2) + + end subroutine offset_1d + + !!!############################################################################# subroutine reallocate_node_elem_arrays(num_elems_new,num_nodes_new) @@ -3707,6 +3732,29 @@ subroutine reallocate_node_elem_arrays(num_elems_new,num_nodes_new) end subroutine reallocate_node_elem_arrays +!!!############################################################################# + + subroutine scale_1d(scale_x, scale_y, scale_z) + !*scale_1d:* scale the 1D tree by the given x,y,z scale values + + real(dp),intent(in) :: scale_x, scale_y, scale_z + + character(len=60) :: sub_name + + ! -------------------------------------------------------------------------- + + sub_name = 'scale_1d' + call enter_exit(sub_name,1) + + node_xyz(1,1:num_nodes) = node_xyz(1,1:num_nodes) * scale_x + node_xyz(2,1:num_nodes) = node_xyz(2,1:num_nodes) * scale_y + node_xyz(3,1:num_nodes) = node_xyz(3,1:num_nodes) * scale_z + + call enter_exit(sub_name,2) + + end subroutine scale_1d + + !!!############################################################################# function get_local_node_f(ndimension,np_global) result(get_local_node)