MCPcopy Create free account
hub / github.com/KratosMultiphysics/Kratos / items

Method items

kratos/python_interface/python_registry.py:117–145  ·  view source on GitHub ↗
(self, Name)

Source from the content-addressed store, hash-verified

115 return py_values, cpp_values
116
117 def items(self, Name):
118 # Check if Name registry level is registered and if it is a value
119 if self.HasItem(Name):
120 if not self.HasItems(Name):
121 err_mgs = f"Asking for the items of '{Name}'. '{Name}' item has no subitems."
122 raise Exception(err_mgs)
123 else:
124 err_msg = f"Asking for the items of '{Name}' non-registered item."
125 raise Exception(err_msg)
126
127 # Get the keys and values
128 py_keys, cpp_keys = self.keys(Name)
129 py_values, cpp_values = self.values(Name)
130
131 # Loop the keys and values to return the items
132 py_items = None
133 if py_keys is not None:
134 py_items = []
135 for py_key, py_value in zip(py_keys, py_values):
136 py_items.append((py_key, py_value))
137
138 cpp_items = None
139 if cpp_keys is not None:
140 cpp_items = []
141 for cpp_key, cpp_value in zip(cpp_keys, cpp_values):
142 cpp_items.append((cpp_key, cpp_value))
143
144 # Return the c++ and Python registry items in a tuple
145 return py_items, cpp_items
146
147 def NumberOfItems(self, Name, Context=RegistryContext.ALL):
148 '''Returns the total number of items in the registry

Callers 8

SaveMethod · 0.45
runTestsFunction · 0.45
ReadModelPartFunction · 0.45
_CreateProcessesMethod · 0.45
print_summary_tableFunction · 0.45
plot_benchmarksFunction · 0.45
PrintTestSummaryFunction · 0.45
GenerateMethod · 0.45

Calls 5

HasItemMethod · 0.95
HasItemsMethod · 0.95
keysMethod · 0.95
valuesMethod · 0.95
appendMethod · 0.45

Tested by 1

runTestsFunction · 0.36