Skip to content

Commit b18b5f5

Browse files
committed
Update to 0.21.0
1 parent 18a1796 commit b18b5f5

File tree

14 files changed

+1761
-101
lines changed

14 files changed

+1761
-101
lines changed

docs/source/example_problems/substructuring.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,7 @@
13351335
"tags": []
13361336
},
13371337
"source": [
1338-
"In the previous subsection, we saw the typical substructuring workflow: concatenate the :py:class:`System<sdynpy.core.sdynpy_system.System>` objects together, select degrees of freedom by closest position, apply constraints, and visualize results. However, because this type of substructuring calculation, where degrees of freedom already exist co-located spatially in the two systems, is common, SDynPy has a shortcut method: \\subspos. This method automatically searches out common degrees of freedom in the :py:class:`System<sdynpy.core.sdynpy_system.System>` objects and applies constraints between them, meaning the entirety of Case 1a can be performed in a single function call."
1338+
"In the previous subsection, we saw the typical substructuring workflow: concatenate the :py:class:`System<sdynpy.core.sdynpy_system.System>` objects together, select degrees of freedom by closest position, apply constraints, and visualize results. However, because this type of substructuring calculation, where degrees of freedom already exist co-located spatially in the two systems, is common, SDynPy has a shortcut method: `substructure_by_position`. This method automatically searches out common degrees of freedom in the :py:class:`System<sdynpy.core.sdynpy_system.System>` objects and applies constraints between them, meaning the entirety of Case 1a can be performed in a single function call."
13391339
]
13401340
},
13411341
{

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ dependencies = [
3939
]
4040

4141
requires-python = '>=3.10'
42-
version = '0.19.0'
42+
version = '0.21.0'
4343

4444
classifiers = [
4545
'Natural Language :: English',
@@ -78,8 +78,8 @@ all = [
7878
]
7979

8080
[project.urls]
81-
Documentation = 'http://structmechtools.cee-gitlab.lan/structural-dynamics-python-libraries/'
82-
Repository = 'https://cee-gitlab.sandia.gov/structMechTools/structural-dynamics-python-libraries'
81+
Documentation = 'https://sandialabs.github.io/sdynpy/'
82+
Repository = 'https://github.com/sandialabs/sdynpy'
8383

8484
[tool.pytest.ini_options]
8585
junit_family = 'xunit2'

src/sdynpy/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
You should have received a copy of the GNU General Public License
1818
along with this program. If not, see <https://www.gnu.org/licenses/>.
1919
"""
20-
from .core import coordinate, colors, array, geometry, shape, data, system, matrix_mod
20+
from .core import coordinate, colors, array, geometry, shape, data, system, matrix_mod, system_nl
2121
from .fileio import unv, uff, rattlesnake, vic, tshaker, pdf3D, escdf
2222
from .fem.sdynpy_exodus import Exodus, ExodusInMemory, read_sierra_matlab_map_file, read_sierra_matlab_matrix_file
2323
from .fem import sdynpy_beam as beam
@@ -59,6 +59,8 @@
5959
power_spectral_density_array = data.power_spectral_density_array
6060
PowerSpectralDensityArray = data.PowerSpectralDensityArray
6161
spectrum_array = data.spectrum_array
62+
ShockResponseSpectrumArray = data.ShockResponseSpectrumArray
63+
shock_response_spectrum_array = data.shock_response_spectrum_array
6264
SpectrumArray = data.SpectrumArray
6365
GUIPlot = data.GUIPlot
6466
CPSDPlot = data.CPSDPlot
@@ -67,3 +69,4 @@
6769
matrix_plot = correlation.matrix_plot
6870
Matrix = matrix_mod.Matrix
6971
matrix = matrix_mod.matrix
72+
SystemNL = system_nl.SystemNL

src/sdynpy/core/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@
2424
from . import sdynpy_array as array
2525
from . import sdynpy_system as system
2626
from . import sdynpy_matrix as matrix_mod
27+
from . import sdynpy_nonlinear_system as system_nl

src/sdynpy/core/sdynpy_coordinate.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,40 @@ def offset_node_ids(self, offset_value):
246246
output = self.copy()
247247
output.node += offset_value
248248
return output
249+
250+
def find_indices(self,coordinate):
251+
"""Finds the indices and signs of the specified coordinates
252+
253+
Parameters
254+
----------
255+
coordinate : CoordinateArray
256+
A CoordinateArray containing the coordinates to find.
257+
258+
Returns
259+
-------
260+
indices : tuple of ndarray
261+
An tuple of arrays of indices into this CoordinateArray for each entry in
262+
`coordinate`, which can be used directly to index this CoordinateArray.
263+
signs : ndarray
264+
An array of sign flips between this CoordinateArray at the indices in
265+
`indices` for each entry in `coordinate`
266+
267+
Raises
268+
------
269+
ValueError
270+
If more than one coordinate matches, or no coordinate matches.
271+
"""
272+
indices = np.zeros((self.ndim,)+coordinate.shape,dtype=int)
273+
signs = np.zeros(coordinate.shape,dtype=int)
274+
for check_index,coord in coordinate.ndenumerate():
275+
index = np.array(np.where(abs(self)==abs(coord)))
276+
if index.shape[-1] == 0:
277+
raise ValueError(f'Coordinate {coordinate} not found in {self}')
278+
if index.shape[-1] > 1:
279+
raise ValueError(f'Coordinate {coordinate} found {index.shape[-1]} times in {self}')
280+
indices[(slice(None),)+check_index] = index[...,0]
281+
signs[check_index] = self[tuple(index)].sign()*coord.sign()
282+
return tuple(indices),signs
249283

250284
@classmethod
251285
def from_matlab_cellstr(cls, cellstr_data):

0 commit comments

Comments
 (0)