Coverage for src/meshpy/four_c/function.py: 100%
10 statements
« prev ^ index » next coverage.py v7.8.0, created at 2025-04-28 04:21 +0000
« prev ^ index » next coverage.py v7.8.0, created at 2025-04-28 04:21 +0000
1# The MIT License (MIT)
2#
3# Copyright (c) 2018-2025 MeshPy Authors
4#
5# Permission is hereby granted, free of charge, to any person obtaining a copy
6# of this software and associated documentation files (the "Software"), to deal
7# in the Software without restriction, including without limitation the rights
8# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9# copies of the Software, and to permit persons to whom the Software is
10# furnished to do so, subject to the following conditions:
11#
12# The above copyright notice and this permission notice shall be included in
13# all copies or substantial portions of the Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21# THE SOFTWARE.
22"""This module implements a basic class to manage functions in the 4C input
23file."""
25from meshpy.core.base_mesh_item import BaseMeshItem as _BaseMeshItem
28class Function(_BaseMeshItem):
29 """Holds information for a function."""
31 def __init__(self, function_list):
32 super().__init__()
33 self.function_list = function_list
35 def __deepcopy__(self, memo):
36 """When deepcopy is called on a mesh, we do not want the same functions
37 to be copied, as this will result in multiple equal functions in the
38 input file."""
40 # Add this object to the memo dictionary.
41 memo[id(self)] = self
43 # Return this object again, as no copy should be created.
44 return self
46 def dump_to_list(self):
47 """Return a list with the items representing this function."""
48 return self.function_list