Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve module structure #404

Merged
merged 5 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions doc/source/api/example_helpers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Example helpers
---------------

.. currentmodule:: ansys.acp.core.example_helpers

.. autosummary::
:toctree: _autosummary

ExampleKeys
get_example_file
1 change: 1 addition & 0 deletions doc/source/api/index.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
API reference

Check warning on line 1 in doc/source/api/index.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] doc/source/api/index.rst#L1

[Google.Headings] 'API reference' should use sentence-style capitalization.
Raw output
{"message": "[Google.Headings] 'API reference' should use sentence-style capitalization.", "location": {"path": "doc/source/api/index.rst", "range": {"start": {"line": 1, "column": 1}}}, "severity": "WARNING"}
=============

This section describes the API of the public PyACP classes, functions,
Expand All @@ -17,3 +17,4 @@
other_types
plot_utils
workflow
example_helpers
5 changes: 2 additions & 3 deletions doc/source/api/material_property_sets.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
Material property sets
----------------------

.. TODO: move these to a public module

.. currentmodule:: ansys.acp.core
.. currentmodule:: ansys.acp.core.material_property_sets

.. autosummary::
:toctree: _autosummary
Expand All @@ -20,6 +18,7 @@ Material property sets
ConstantWovenStressLimits
FieldVariable
InterpolationOptions
PuckMaterialType
VariableDensity
VariableEngineeringConstants
VariableFabricFiberAngle
Expand Down
3 changes: 0 additions & 3 deletions doc/source/api/other_types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,13 @@ Other data types
EdgeSetType
ElementalDataType
FeFormat
FieldVariable
GeometricalRuleType
IgnorableEntity
InterpolationOptions
LookUpTable3DInterpolationAlgorithm
LookUpTableColumnValueType
NodalDataType
PlyCutoffType
PlyType
PuckMaterialType
RosetteSelectionMethod
SensorType
StatusType
Expand Down
14 changes: 7 additions & 7 deletions examples/001_basic_flat_plate.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@
# Import pyACP dependencies
from ansys.acp.core import (
ACPWorkflow,
ConstantEngineeringConstants,
ConstantStrainLimits,
ExampleKeys,
PlyType,
example_helpers,
get_composite_post_processing_files,
get_directions_plotter,
get_dpf_unit_system,
get_example_file,
launch_acp,
material_property_sets,
print_model,
)

Expand All @@ -44,7 +42,9 @@
# Get example file from server
tempdir = tempfile.TemporaryDirectory()
WORKING_DIR = pathlib.Path(tempdir.name)
input_file = get_example_file(ExampleKeys.BASIC_FLAT_PLATE_CDB, WORKING_DIR)
input_file = example_helpers.get_example_file(
example_helpers.ExampleKeys.BASIC_FLAT_PLATE_CDB, WORKING_DIR
)

# %%
# Launch the PyACP server and connect to it.
Expand Down Expand Up @@ -74,12 +74,12 @@
# %%
# Create an orthotropic material and fabric including strain limits, which are later
# used to post-process the simulation.
engineering_constants = ConstantEngineeringConstants(
engineering_constants = material_property_sets.ConstantEngineeringConstants(
E1=5e10, E2=1e10, E3=1e10, nu12=0.28, nu13=0.28, nu23=0.3, G12=5e9, G23=4e9, G31=4e9
)

strain_limit = 0.01
strain_limits = ConstantStrainLimits(
strain_limits = material_property_sets.ConstantStrainLimits(
eXc=-strain_limit,
eYc=-strain_limit,
eZc=-strain_limit,
Expand Down
6 changes: 4 additions & 2 deletions examples/002_start_from_existing_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
import tempfile

import ansys.acp.core as pyacp
from ansys.acp.core import ACPWorkflow, ExampleKeys, get_example_file, print_model
from ansys.acp.core import ACPWorkflow, example_helpers, print_model

# %%
# Get example file from server
tempdir = tempfile.TemporaryDirectory()
WORKING_DIR = pathlib.Path(tempdir.name)
input_acph5_file = get_example_file(ExampleKeys.BASIC_FLAT_PLATE_ACPH5, WORKING_DIR)
input_acph5_file = example_helpers.get_example_file(
example_helpers.ExampleKeys.BASIC_FLAT_PLATE_ACPH5, WORKING_DIR
)

# Launch the PyACP server and connect to it.
acp = pyacp.launch_acp()
Expand Down
52 changes: 3 additions & 49 deletions src/ansys/acp/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import importlib.metadata

from . import example_helpers, material_property_sets
from ._model_printer import get_model_tree, print_model
from ._plotter import get_directions_plotter
from ._server import ACP, DirectLaunchConfig, DockerComposeLaunchConfig, LaunchMode, launch_acp
Expand All @@ -18,16 +19,6 @@
BooleanSelectionRuleNodalData,
CADComponent,
CADGeometry,
ConstantDensity,
ConstantEngineeringConstants,
ConstantFabricFiberAngle,
ConstantLaRCConstants,
ConstantPuckConstants,
ConstantStrainLimits,
ConstantStressLimits,
ConstantTsaiWuConstants,
ConstantWovenCharacterization,
ConstantWovenStressLimits,
CutoffMaterialType,
CutoffRuleType,
CutoffSelectionRule,
Expand All @@ -49,13 +40,11 @@
Fabric,
FabricWithAngle,
FeFormat,
FieldVariable,
GeometricalRuleType,
GeometricalSelectionRule,
GeometricalSelectionRuleElementalData,
GeometricalSelectionRuleNodalData,
IgnorableEntity,
InterpolationOptions,
Lamina,
LinkedSelectionRule,
LookUpTable1D,
Expand Down Expand Up @@ -84,7 +73,6 @@
ProductionPly,
ProductionPlyElementalData,
ProductionPlyNodalData,
PuckMaterialType,
Rosette,
RosetteSelectionMethod,
ScalarData,
Expand All @@ -105,24 +93,13 @@
TubeSelectionRuleElementalData,
TubeSelectionRuleNodalData,
UnitSystemType,
VariableDensity,
VariableEngineeringConstants,
VariableFabricFiberAngle,
VariableLaRCConstants,
VariableOffsetSelectionRule,
VariableOffsetSelectionRuleElementalData,
VariableOffsetSelectionRuleNodalData,
VariablePuckConstants,
VariableStrainLimits,
VariableStressLimits,
VariableTsaiWuConstants,
VariableWovenCharacterization,
VariableWovenStressLimits,
VectorData,
VirtualGeometry,
VirtualGeometryDimension,
)
from ._utils.example_helpers import ExampleKeys, get_example_file
from ._workflow import ACPWorkflow, get_composite_post_processing_files, get_dpf_unit_system

__version__ = importlib.metadata.version(__name__.replace(".", "-"))
Expand All @@ -141,16 +118,6 @@
"BooleanSelectionRuleNodalData",
"CADComponent",
"CADGeometry",
"ConstantDensity",
"ConstantEngineeringConstants",
"ConstantFabricFiberAngle",
"ConstantLaRCConstants",
"ConstantPuckConstants",
"ConstantStrainLimits",
"ConstantStressLimits",
"ConstantTsaiWuConstants",
"ConstantWovenCharacterization",
"ConstantWovenStressLimits",
"CutoffMaterialType",
"CutoffRuleType",
"CutoffSelectionRule",
Expand All @@ -171,21 +138,18 @@
"ElementSet",
"ElementSetElementalData",
"ElementSetNodalData",
"ExampleKeys",
"example_helpers",
"Fabric",
"FabricWithAngle",
"FeFormat",
"FieldVariable",
"GeometricalRuleType",
"GeometricalSelectionRule",
"GeometricalSelectionRuleElementalData",
"GeometricalSelectionRuleNodalData",
"get_composite_post_processing_files",
"get_dpf_unit_system",
"get_example_file",
"get_model_tree",
"IgnorableEntity",
"InterpolationOptions",
"Lamina",
"launch_acp",
"LaunchMode",
Expand All @@ -197,6 +161,7 @@
"LookUpTable3DInterpolationAlgorithm",
"LookUpTableColumnValueType",
"Material",
"material_property_sets",
"Model",
"ModelElementalData",
"ModelingGroup",
Expand All @@ -217,7 +182,6 @@
"ProductionPly",
"ProductionPlyElementalData",
"ProductionPlyNodalData",
"PuckMaterialType",
"Rosette",
"RosetteSelectionMethod",
"ScalarData",
Expand All @@ -238,19 +202,9 @@
"TubeSelectionRuleElementalData",
"TubeSelectionRuleNodalData",
"UnitSystemType",
"VariableDensity",
"VariableEngineeringConstants",
"VariableFabricFiberAngle",
"VariableLaRCConstants",
"VariableOffsetSelectionRule",
"VariableOffsetSelectionRuleElementalData",
"VariableOffsetSelectionRuleNodalData",
"VariablePuckConstants",
"VariableStrainLimits",
"VariableStressLimits",
"VariableTsaiWuConstants",
"VariableWovenCharacterization",
"VariableWovenStressLimits",
"VectorData",
"VirtualGeometry",
"VirtualGeometryDimension",
Expand Down
47 changes: 1 addition & 46 deletions src/ansys/acp/core/_tree_objects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,32 +55,7 @@
from .lookup_table_1d_column import LookUpTable1DColumn
from .lookup_table_3d import LookUpTable3D
from .lookup_table_3d_column import LookUpTable3DColumn
from .material import (
ConstantDensity,
ConstantEngineeringConstants,
ConstantFabricFiberAngle,
ConstantLaRCConstants,
ConstantPuckConstants,
ConstantStrainLimits,
ConstantStressLimits,
ConstantTsaiWuConstants,
ConstantWovenCharacterization,
ConstantWovenStressLimits,
FieldVariable,
InterpolationOptions,
Material,
PuckMaterialType,
VariableDensity,
VariableEngineeringConstants,
VariableFabricFiberAngle,
VariableLaRCConstants,
VariablePuckConstants,
VariableStrainLimits,
VariableStressLimits,
VariableTsaiWuConstants,
VariableWovenCharacterization,
VariableWovenStressLimits,
)
from .material import Material
from .model import FeFormat, IgnorableEntity, Model, ModelElementalData, ModelNodalData
from .modeling_group import ModelingGroup
from .modeling_ply import ModelingPly, ModelingPlyElementalData, ModelingPlyNodalData, TaperEdge
Expand Down Expand Up @@ -126,16 +101,6 @@
"BooleanSelectionRuleNodalData",
"CADComponent",
"CADGeometry",
"ConstantDensity",
"ConstantEngineeringConstants",
"ConstantFabricFiberAngle",
"ConstantLaRCConstants",
"ConstantPuckConstants",
"ConstantStrainLimits",
"ConstantStressLimits",
"ConstantTsaiWuConstants",
"ConstantWovenCharacterization",
"ConstantWovenStressLimits",
"CutoffMaterialType",
"CutoffRuleType",
"CutoffSelectionRule",
Expand Down Expand Up @@ -213,19 +178,9 @@
"TubeSelectionRuleElementalData",
"TubeSelectionRuleNodalData",
"UnitSystemType",
"VariableDensity",
"VariableEngineeringConstants",
"VariableFabricFiberAngle",
"VariableLaRCConstants",
"VariableOffsetSelectionRule",
"VariableOffsetSelectionRuleElementalData",
"VariableOffsetSelectionRuleNodalData",
"VariablePuckConstants",
"VariableStrainLimits",
"VariableStressLimits",
"VariableTsaiWuConstants",
"VariableWovenCharacterization",
"VariableWovenStressLimits",
"VectorData",
"VirtualGeometry",
"VirtualGeometryDimension",
Expand Down
53 changes: 1 addition & 52 deletions src/ansys/acp/core/_tree_objects/material/__init__.py
Original file line number Diff line number Diff line change
@@ -1,54 +1,3 @@
from .material import Material
from .property_sets import (
ConstantDensity,
ConstantEngineeringConstants,
ConstantFabricFiberAngle,
ConstantLaRCConstants,
ConstantPuckConstants,
ConstantStrainLimits,
ConstantStressLimits,
ConstantTsaiWuConstants,
ConstantWovenCharacterization,
ConstantWovenStressLimits,
FieldVariable,
InterpolationOptions,
PuckMaterialType,
VariableDensity,
VariableEngineeringConstants,
VariableFabricFiberAngle,
VariableLaRCConstants,
VariablePuckConstants,
VariableStrainLimits,
VariableStressLimits,
VariableTsaiWuConstants,
VariableWovenCharacterization,
VariableWovenStressLimits,
)

__all__ = [
"ConstantDensity",
"ConstantEngineeringConstants",
"ConstantFabricFiberAngle",
"ConstantLaRCConstants",
"ConstantPuckConstants",
"ConstantStrainLimits",
"ConstantStressLimits",
"ConstantTsaiWuConstants",
"ConstantWovenCharacterization",
"ConstantWovenStressLimits",
"FieldVariable",
"InterpolationOptions",
"Material",
"property_sets",
"PuckMaterialType",
"VariableDensity",
"VariableEngineeringConstants",
"VariableFabricFiberAngle",
"VariableLaRCConstants",
"VariablePuckConstants",
"VariableStrainLimits",
"VariableStressLimits",
"VariableTsaiWuConstants",
"VariableWovenCharacterization",
"VariableWovenStressLimits",
]
__all__ = ["Material"]
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
"""Helpers used in the PyACP examples.

These utilities can download the input files used in the PyACP examples.
"""


import dataclasses
from enum import Enum, auto
import pathlib
Expand Down
Loading
Loading