Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions pysemtools/datatypes/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def __init__(self, comm, data=None):
if not isinstance(data, NoneType):

self.log.tic()
self.log.write("info", "Initializing Field object from HexaData")
self.log.write("debug", "Initializing Field object from HexaData")

vars_ = data.var
self.vel_fields = vars_[1]
Expand All @@ -142,10 +142,10 @@ def __init__(self, comm, data=None):

self.t = data.time

self.log.write("info", "Field object initialized")
self.log.toc()
self.log.write("debug", "Field object initialized")
self.log.toc(message="Field object initialized from HexaData")
else:
self.log.write("info", "Initializing empty Field object")
self.log.write("debug", "Initializing empty Field object")

def update_vars(self):
"""
Expand Down Expand Up @@ -340,6 +340,9 @@ def update_vars(self):
self.registry[f"s{i}"] = self.fields["scal"][i]
self.registry_pos[f"s{i}"] = f"scal_{i}"

if self.registry.keys().__len__() > 0:
self.log.write("info", f"Field registry updated with: {list(self.registry.keys())} - dtype: {self.registry[list(self.registry.keys())[0]].dtype}")

def clear(self):
"""
Clear the registry and the fields.
Expand Down
24 changes: 12 additions & 12 deletions pysemtools/datatypes/msh.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ class Mesh:
"""

def __init__(
self, comm, data=None, x=None, y=None, z=None, elmap=None, create_connectivity=False, bckend="numpy"
self, comm, data=None, x=None, y=None, z=None, elmap=None, create_connectivity=False, bckend="numpy", log_level=None
):

self.log = Logger(comm=comm, module_name="Mesh")
self.log = Logger(comm=comm, module_name="Mesh", level=log_level)
self.create_connectivity_bool = create_connectivity

self.bckend = bckend
Expand All @@ -107,7 +107,7 @@ def __init__(
self.init_from_coords(comm, x, y, z, elmap=elmap)

else:
self.log.write("info", "Initializing empty Mesh object.")
self.log.write("debug", "Initializing empty Mesh object.")

def init_from_data(self, comm, data):
"""
Expand Down Expand Up @@ -165,7 +165,7 @@ def init_from_coords(self, comm, x, y, z, elmap=None):
"""

self.log.tic()
self.log.write("info", "Initializing Mesh object from x,y,z ndarrays.")
self.log.write("debug", "Initializing Mesh object from x,y,z ndarrays.")

self.x = x
self.y = y
Expand All @@ -174,9 +174,9 @@ def init_from_coords(self, comm, x, y, z, elmap=None):

self.init_common(comm)

self.log.write("info", "Mesh object initialized.")
self.log.write("info", f"Mesh data is of type: {self.x.dtype}")
self.log.toc()
self.log.write("debug", "Mesh object initialized.")
self.log.write("debug", f"Mesh data is of type: {self.x.dtype}")
self.log.toc(message=f"Mesh object initialized from coordinates with type: {self.x.dtype}")

def init_common(self, comm):
"""
Expand All @@ -195,7 +195,7 @@ def init_common(self, comm):
Nothing is returned, the attributes are set in the object.
"""

self.log.write("info", "Initializing common attributes.")
self.log.write("debug", "Initializing common attributes.")

self.lx = np.int64(
self.x.shape[3]
Expand Down Expand Up @@ -279,7 +279,7 @@ def get_vertices(self):
we store 3 coordinates for each vertex.
'''

self.log.write("info", "Getting vertices")
self.log.write("debug", "Getting vertices")

if self.gdim == 2:
self.vertices = np.zeros((self.nelv, 4, 3), dtype=self.x.dtype) # 4 vertices, 3 coords (z = 0)
Expand Down Expand Up @@ -310,7 +310,7 @@ def get_edge_centers(self):
we store 3 coordinates for each edge.
'''

self.log.write("info", "Getting edge centers")
self.log.write("debug", "Getting edge centers")

if self.gdim == 2:
self.edge_centers = np.zeros((self.nelv, 4, 3), dtype=self.x.dtype) # 4 vertices, 3 coords (z = 0)
Expand Down Expand Up @@ -348,10 +348,10 @@ def get_facet_centers(self):
'''

if self.gdim == 2:
self.log.write("info", "Facet centers not available for 2D")
self.log.write("debug", "Facet centers not available for 2D")

elif self.gdim == 3:
self.log.write("info", "Getting facet centers")
self.log.write("debug", "Getting facet centers")

self.facet_centers = np.zeros((self.nelv, 6, 3), dtype=self.x.dtype) # 6 facets, 3 coordinates

Expand Down
10 changes: 5 additions & 5 deletions pysemtools/datatypes/msh_partitioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(
y_ = msh.y[self.compliant_elements]
z_ = msh.z[self.compliant_elements]

sub_mesh = Mesh(comm, x=x_, y=y_, z=z_, create_connectivity=False)
sub_mesh = Mesh(comm, x=x_, y=y_, z=z_, create_connectivity=False, log_level="hide")

self.partition_nelv = sub_mesh.nelv
self.partition_glb_nelv = sub_mesh.glb_nelv
Expand Down Expand Up @@ -87,16 +87,16 @@ def create_partitioned_mesh(
"""

self.log.write(
"info",
"debug",
f"Partitioning the mesh coordinates with {partitioning_algorithm} algorithm",
)
x_ = self.redistribute_field_elements(msh.x, partitioning_algorithm)
y_ = self.redistribute_field_elements(msh.y, partitioning_algorithm)
z_ = self.redistribute_field_elements(msh.z, partitioning_algorithm)

self.log.write("info", "Creating mesh object")
self.log.write("debug", "Creating mesh object")
partitioned_mesh = Mesh(
self.rt.comm, x=x_, y=y_, z=z_, create_connectivity=create_conectivity
self.rt.comm, x=x_, y=y_, z=z_, create_connectivity=create_conectivity, log_level="hide"
)

return partitioned_mesh
Expand Down Expand Up @@ -124,7 +124,7 @@ def create_partitioned_field(
"""

self.log.write(
"info",
"debug",
f"Partitioning the field object with {partitioning_algorithm} algorithm",
)

Expand Down
Loading