Commit cd82df04 authored by Michel Henry's avatar Michel Henry
Browse files

coorection load_mesh_2

parent edd22415
Pipeline #8400 passed with stages
in 3 minutes and 9 seconds
......@@ -497,7 +497,7 @@ static void _gmsh_mesh_read_2(GmshMesh *mesh, FileReader *r) {
file_reader_next_line(r);
p->n_affine = 0;
p->affine = NULL;
file_reader_next_line(r);
// file_reader_next_line(r);
p->n_nodes = file_reader_get_int(r);
file_reader_next_line(r);
p->nodes = malloc(sizeof(size_t)*2*p->n_nodes);
......
......@@ -261,6 +261,8 @@ class Mesh() :
return self._lib.gmsh_mesh_entity_n_physicals(self._mesh, c_int(dim), c_int(ie))
def entity_physicals(self,dim,ie):
n_physicals = self.entity_n_physicals(dim,ie)
if n_physicals == 0 :
return np.array([])
f = getattr(self._lib, "gmsh_mesh_entity_physicals")
f.restype = POINTER(c_int)
return np.ctypeslib.as_array(f(self._mesh, c_int(dim), c_int(ie)),shape=(n_physicals,))
......@@ -280,7 +282,7 @@ class Mesh() :
n_partitions = self.element_n_partitions(dim,ie)
f = getattr(self._lib, "gmsh_mesh_element_partitions")
f.restype = POINTER(c_int)
return np.ctypeslib.as_array(f(self._mesh, c_int(dim), c_int(ie)),shape=(n_partitions,))
return None if n_partitions < 1 else np.ctypeslib.as_array(f(self._mesh, c_int(dim), c_int(ie)),shape=(n_partitions,))
def element_n_nodes(self,dim,ie):
self._lib.gmsh_mesh_element_n_nodes.restype = c_size_t
return self._lib.gmsh_mesh_element_n_nodes(self._mesh, c_int(dim), c_int(ie))
......@@ -288,7 +290,7 @@ class Mesh() :
nodes_by_elt = self.element_n_nodes(dim,ie)
f = getattr(self._lib, "gmsh_mesh_element_nodes_tag")
f.restype = POINTER(c_size_t)
return np.ctypeslib.as_array(f(self._mesh, c_int(dim), c_int(ie), c_int(ielt)),shape=(nodes_by_elt,))
return None if nodes_by_elt < 1 else np.ctypeslib.as_array(f(self._mesh, c_int(dim), c_int(ie), c_int(ielt)),shape=(nodes_by_elt,))
def getPhysicalNumber(self, dim, name) :
t = self.physicals[dim].get(name, None)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment