Skip to content

Commit

Permalink
Add keyword classes (#561)
Browse files Browse the repository at this point in the history
Co-authored-by: Mohamed Koubaa <koubaa@github.com>
  • Loading branch information
koubaa and Mohamed Koubaa authored Nov 5, 2024
1 parent df09345 commit 854de6c
Show file tree
Hide file tree
Showing 3,190 changed files with 1,299,553 additions and 9 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
8 changes: 6 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ exclude: |
src/ansys/dyna/core/pre/doc/|
src/ansys/dyna/core/pre/DigitalWeaving_BCs.py|
src/ansys/dyna/core/pre/kwprocess_pb2.py|
src/ansys/dyna/core/pre/kwprocess_pb2_grpc.py
)
src/ansys/dyna/core/pre/kwprocess_pb2_grpc.py|
src/ansys/dyna/core/keywords/keyword_classes/auto/|
src/ansys/dyna/core/keywords/keyword_classes/type_mapping.py|
src/ansys/dyna/core/keywords/keyword_classes/auto_keywords.py|
.*\.k$
)
repos:

- repo: https://github.com/psf/black
Expand Down
2 changes: 1 addition & 1 deletion codegen/templates/importer.j2
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{license}}
{% for keyword in keywords %}
{% if keyword.is_autogenerated %}
from ansys.dyna.keywords.keyword_classes.auto.{{keyword.filename}} import {{keyword.classname}}
from ansys.dyna.core.keywords.keyword_classes.auto.{{keyword.filename}} import {{keyword.classname}}
{% endif %}
{% endfor %}
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@
# Configuration for Sphinx autoapi
extensions.append("autoapi.extension")
autoapi_dirs = ["../../src/ansys"]
autoapi_ignore = ["*keyword_classes/auto*"]
autoapi_type = "python"
autoapi_dirs = ["../../src/ansys"]
autoapi_options = [
"members",
"undoc-members",
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ dependencies = ["ansys-dpf-core>=0.7.2",
"pyvista>=0.43.4",
"hollerith==0.4.1",
"numpy>=2.0.0",
"pandas>=2.0"
"pandas>=2.0",
"appdirs>=1.4.4"
]

[project.optional-dependencies]
Expand Down
3 changes: 2 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ markers =
run: tests that exercise the `run` subpackage
keywords: tests that exercies the `keyword` subpackage
viz: tests that do 3d visualization
xfail_strict = true
xfail_strict = true
python_files = "test_*.py"
1 change: 1 addition & 0 deletions src/ansys/dyna/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from ansys.dyna.core.keywords import keywords
from ansys.dyna.core.lib.deck import Deck
from ansys.dyna.core.solver.dynasolver import *
import ansys.dyna.core.solver.grpc_tags
Expand Down
39 changes: 39 additions & 0 deletions src/ansys/dyna/core/keywords/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

"""ANSYS Dyna Keywords Module."""

import os

import appdirs

__all__ = ["keywords", "EXAMPLES_PATH", "USER_DATA_PATH"]

import ansys.dyna.core.keywords.keyword_classes as keywords # noqa: F401

USER_DATA_PATH = appdirs.user_data_dir(appname="ansys_dyna_keywords", appauthor="Ansys")
if not os.path.exists(USER_DATA_PATH):
os.makedirs(USER_DATA_PATH)

EXAMPLES_PATH = os.path.join(USER_DATA_PATH, "examples")
if not os.path.exists(EXAMPLES_PATH):
os.makedirs(EXAMPLES_PATH)
44 changes: 44 additions & 0 deletions src/ansys/dyna/core/keywords/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

"""Version of ansys-dyna-keywords library.
On the ``main`` branch, use 'dev0' to denote a development version.
For example:
version_info = 0, 1, 'dev0'
Examples
--------
Print the version
>>> from ansys.dyna import keywords
>>> print(library.__version__)
0.1.dev0
"""

# major, minor, patch
version_info = 0, 1, "dev0"

# Nice string for the version
__version__ = ".".join(map(str, version_info))
24 changes: 24 additions & 0 deletions src/ansys/dyna/core/keywords/keyword_classes/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

from ansys.dyna.core.keywords.keyword_classes.auto_keywords import * # noqa: F401, F403
from ansys.dyna.core.keywords.keyword_classes.manual_keywords import * # noqa: F401, F403
21 changes: 21 additions & 0 deletions src/ansys/dyna/core/keywords/keyword_classes/auto/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
Loading

0 comments on commit 854de6c

Please sign in to comment.