Skip to content

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
david-zwicker committed Jan 5, 2024
1 parent 5190a4d commit 09c277b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
9 changes: 8 additions & 1 deletion pde/fields/tensorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@


class Tensor2Field(DataFieldBase):
"""Tensor field of rank 2 discretized on a grid"""
"""Tensor field of rank 2 discretized on a grid
Warning:
Components of the tensor field are given in the local basis. While the local
basis is identical to the global basis in Cartesian coordinates, the local basis
depends on position in curvilinear coordinate systems. Moreover, the field
always contains all components, even if the underlying grid assumes symmetries.
"""

rank = 2

Expand Down
9 changes: 8 additions & 1 deletion pde/fields/vectorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@


class VectorField(DataFieldBase):
"""Vector field discretized on a grid"""
"""Vector field discretized on a grid
Warning:
Components of the vector field are given in the local basis. While the local
basis is identical to the global basis in Cartesian coordinates, the local basis
depends on position in curvilinear coordinate systems. Moreover, the field
always contains all components, even if the underlying grid assumes symmetries.
"""

rank = 1

Expand Down
8 changes: 4 additions & 4 deletions pde/grids/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,9 +601,9 @@ def _boundary_coordinates(self, axis: int, upper: bool) -> np.ndarray:
return np.stack(points, -1).reshape(shape) # type: ignore

@property
@abstractmethod
def volume(self) -> float:
"""float: total volume of the grid"""
raise NotImplementedError

Check warning on line 606 in pde/grids/base.py

View check run for this annotation

Codecov / codecov/patch

pde/grids/base.py#L606

Added line #L606 was not covered by tests

@abstractmethod
def point_to_cartesian(
Expand Down Expand Up @@ -913,7 +913,6 @@ def get_boundary_conditions(

return bcs

@abstractmethod
def get_line_data(self, data: np.ndarray, extract: str = "auto") -> dict[str, Any]:
"""return a line cut through the grid
Expand All @@ -928,8 +927,8 @@ def get_line_data(self, data: np.ndarray, extract: str = "auto") -> dict[str, An
dict: A dictionary with information about the line cut, which is convenient
for plotting.
"""
raise NotImplementedError

Check warning on line 930 in pde/grids/base.py

View check run for this annotation

Codecov / codecov/patch

pde/grids/base.py#L930

Added line #L930 was not covered by tests

@abstractmethod
def get_image_data(self, data: np.ndarray) -> dict[str, Any]:
"""return a 2d-image of the data
Expand All @@ -940,6 +939,7 @@ def get_image_data(self, data: np.ndarray) -> dict[str, Any]:
Returns:
dict: A dictionary with information about the data convenient for plotting.
"""
raise NotImplementedError

Check warning on line 942 in pde/grids/base.py

View check run for this annotation

Codecov / codecov/patch

pde/grids/base.py#L942

Added line #L942 was not covered by tests

def get_vector_data(self, data: np.ndarray) -> dict[str, Any]:
"""return data to visualize vector field
Expand All @@ -953,7 +953,6 @@ def get_vector_data(self, data: np.ndarray) -> dict[str, Any]:
"""
raise NotImplementedError

Check warning on line 954 in pde/grids/base.py

View check run for this annotation

Codecov / codecov/patch

pde/grids/base.py#L954

Added line #L954 was not covered by tests

@abstractmethod
def get_random_point(
self,
*,
Expand All @@ -976,6 +975,7 @@ def get_random_point(
Returns:
:class:`~numpy.ndarray`: The coordinates of the random point
"""
raise NotImplementedError

Check warning on line 978 in pde/grids/base.py

View check run for this annotation

Codecov / codecov/patch

pde/grids/base.py#L978

Added line #L978 was not covered by tests

@classmethod
def register_operator(
Expand Down

0 comments on commit 09c277b

Please sign in to comment.