diff --git a/models/dolicorhynchops_10k_contact.py b/models/dolicorhynchops_10k_contact.py index 0ed0880531922e153ac4cd63969d1e39e5ad7326..108d6bd6328cb4b312895de99cb4a04875b97ddf 100644 --- a/models/dolicorhynchops_10k_contact.py +++ b/models/dolicorhynchops_10k_contact.py @@ -9,7 +9,7 @@ def parms(d={}): path = 'dolicorhynchops/10k' p['mandible'] = f'{path}/mandible.ply' # p['teeth'] = f'{path}/teeth.off' - p['LTMJ'] = [0.1458893, -73.13895, 227.3909], + p['LTMJ'] = [0.1458893, -73.13895, 227.3909] p['RTMJ'] = f'{path}/RTMJ.off' p['muscles'] = [ { diff --git a/models/mandiblemodel.py b/models/mandiblemodel.py index e1b7401b40b3afa5ddc12816c613b1683fcaeef0..ff962f6f5076d52075e26889db29c459b0932b82 100644 --- a/models/mandiblemodel.py +++ b/models/mandiblemodel.py @@ -19,8 +19,8 @@ def parms(d={}): path = 'dolicorhynchops/10k' p['mandible'] = f'{path}/mandible.ply' # mandible mesh (.ply/.geo/.msh) p['teeth'] = f'{path}/teeth.off' # one or several vertices (.ply/.off) (used if p['food']=='fixteeth') - p['LTMJ'] = f'{path}/LTMJ.off' # left temporomandibular joint - 1 vertex (.ply/.off) - p['RTMJ'] = f'{path}/RTMJ.off' # right temporomandibular joint - 1 vertex (.ply/.off) + p['LTMJ'] = [0.1458893, -73.13895, 227.3909] # left temporomandibular joint - 1 vertex (.ply/.off/coordinates) + p['RTMJ'] = f'{path}/RTMJ.off' # right temporomandibular joint - 1 vertex (.ply/.off/coordinates) p['muscles'] = [ { 'file': f'{path}/Lmuscle.ply', 'force': 100., 'focalpt':f'{path}/LmuscleF.off', 'method':'T'}, { 'file': f'{path}/Rmuscle.off', 'force': 100., 'focalpt':f'{path}/RmuscleF.off', 'method':'T'} @@ -275,14 +275,20 @@ def extract_nodes_from_group(group): return nods_no, nods_pos -def create_group(mesh_file, all_no, all_coords, domain, groups, gname=None): - """loads the mesh file "mesh_file" and identify vertices among vertices +def create_group(mesh_file_or_coord, all_no, all_coords, domain, groups, gname=None): + """loads the mesh file "mesh_file_or_coord" and identify vertices among vertices stored in all_coords. - Then, the routine creates a group named "gname" (built from mesh_file if None) + Then, the routine creates a group named "gname" (built from mesh_file_or_coord if None) """ - # load mesh file - fullpath = os.path.join(os.path.dirname(__file__), mesh_file) - nodes, tris = boneload.load_msh(fullpath) + # load mesh file + if isinstance(mesh_file_or_coord, str): + fullpath = os.path.join(os.path.dirname(__file__), mesh_file_or_coord) + nodes, tris = boneload.load_msh(fullpath) + else: + nodes = [ mesh_file_or_coord ] + print(f'nodes={nodes}') + print(f'mesh_file_or_coord={mesh_file_or_coord}') + tris = [] # identify nodes of the mesh among the given vertices of the main mesh ntags = boneload.identify_nodes(nodes, all_no, all_coords) @@ -290,7 +296,7 @@ def create_group(mesh_file, all_no, all_coords, domain, groups, gname=None): # create a metafor group groupset = domain.getGeometry().getGroupSet() if gname is None: - gname, _ = os.path.splitext(os.path.basename(mesh_file)) + gname, _ = os.path.splitext(os.path.basename(mesh_file_or_coord)) group = groupset.add(Group(groupset.getLargestNo()+1)) groups[gname] = group @@ -300,7 +306,7 @@ def create_group(mesh_file, all_no, all_coords, domain, groups, gname=None): group.addMeshPoint(nodeset(tag)) print(f'group #{group.getNo()} ({gname}) ' \ - f'created from {mesh_file} ({group.getNumberOfMeshPoints()} nodes)') + f'created from {mesh_file_or_coord} ({group.getNumberOfMeshPoints()} nodes)') return gname, nodes, tris, ntags