diff --git a/Markdown/ansys_codefest/ansys.codefest.mapdl.Beam.md b/Markdown/ansys_codefest/ansys.codefest.mapdl.Beam.md index 1100524ea5..ffdef4a33f 100644 --- a/Markdown/ansys_codefest/ansys.codefest.mapdl.Beam.md +++ b/Markdown/ansys_codefest/ansys.codefest.mapdl.Beam.md @@ -1,6 +1,17 @@ # class `Beam` -Continuous material linking two nodes. +Dataclass for continuous material linking two nodes. + + + +**Args:** + + - `start`: starting node of beam + - `end`: ending node of beam + - `section`: cross-section of beam + - `material`: material of beam + - `number`: beam number + - `stress`: maximum stress experienced by beam. Initialises as 0. ### method `Beam.__init__` diff --git a/Markdown/ansys_codefest/ansys.codefest.mapdl.BeamXn.md b/Markdown/ansys_codefest/ansys.codefest.mapdl.BeamXn.md index 80ded29801..a323884a59 100644 --- a/Markdown/ansys_codefest/ansys.codefest.mapdl.BeamXn.md +++ b/Markdown/ansys_codefest/ansys.codefest.mapdl.BeamXn.md @@ -4,13 +4,13 @@ Beam cross-section enum. In PyMAPDL the beam cross-sections correspond to the following sectypes. -* RECT = RECTANGLE = 1 + * RECT = RECTANGLE = 1 -* HREC = RECTANGLETUBE = 4 + * HREC = RECTANGLETUBE = 4 -* CSOLID = CIRCLE = 2 + * CSOLID = CIRCLE = 2 -* CTUBE = CYLINDER = 3 + * CTUBE = CYLINDER = 3 Dimensions structure for each cross-section shown below: diff --git a/Markdown/ansys_codefest/ansys.codefest.mapdl.Blueprint.md b/Markdown/ansys_codefest/ansys.codefest.mapdl.Blueprint.md index e378fc199c..c4f8fb42e0 100644 --- a/Markdown/ansys_codefest/ansys.codefest.mapdl.Blueprint.md +++ b/Markdown/ansys_codefest/ansys.codefest.mapdl.Blueprint.md @@ -2,6 +2,13 @@ # class `Blueprint` The Plan/Blueprint for a simulation. Contains nodes, beams and BCs. + + +**Args:** + + - `nodes`: list of nodes created for the blueprint + - `beams`: list of beams created for the blueprint + ### method `Blueprint.__init__` ```python diff --git a/Markdown/ansys_codefest/ansys.codefest.mapdl.BuildyMcBuildFace.md b/Markdown/ansys_codefest/ansys.codefest.mapdl.BuildyMcBuildFace.md index 8697dcdaeb..d02ebad87c 100644 --- a/Markdown/ansys_codefest/ansys.codefest.mapdl.BuildyMcBuildFace.md +++ b/Markdown/ansys_codefest/ansys.codefest.mapdl.BuildyMcBuildFace.md @@ -2,7 +2,16 @@ # class `BuildyMcBuildFace` Instance of the bridge-building machine: BuildyMcBuildFace. -You can submit attempts and look at the challenge input via this class. Instances of this class should NOT be created directly, but should be created by one of the `Start` methods. +You can submit attempts and look at the challenge input via this class. Instances of this class should NOT be created directly, but should be created by one of the `Start` methods. Hence, constructor args are all private parameters. + + + +**Args:** + + - `_blueprint`: the blueprint to build designs from + - `_challenge`: Challenge object representing what is being tackled + - `_mapdl_loc`: path to alternative mapdl executable + - `_server`: Optional Server object containing connection details. ### method `BuildyMcBuildFace.__init__` @@ -11,8 +20,7 @@ __init__( _blueprint: ansys.codefest.mapdl.mechanics.core.Blueprint, _challenge: ansys.codefest.mapdl.tools.Challenge, _mapdl_loc: pathlib.Path = None, - _server: ansys.codefest.mapdl.tools.Server = None, - _BuildyMcBuildFace__log_path: pathlib.Path = WindowsPath('.attempt_logs') + _server: ansys.codefest.mapdl.tools.Server = None ) → None ``` @@ -49,42 +57,18 @@ Construct bridge from a design. Depending on the design this step may take time. The method does three things in this order: + 1. Validate the design can be used to create a simulation + 2. Create a simulation blueprint from the design -1. Validate the design can be used to create a simulation 2. Create a simulation blueprint from the design 3. Create a simulation from the blueprint and execute it 4. Create a Bridge object with the simulation and return it + 3. Create a simulation from the blueprint and execute it + + 4. Create a Bridge object with the simulation and return it Steps 1 and 2 are typically very fast, but 3 can take significantly longer depending on the complexity of your design. If your submission does not pass the validation step, it does not count as an attempt. Include plot=True as an arg if you'd like matplotlib to plot the result as well. - - -**Examples:** - ```python-repl - >>> import ansys.codefest.mapdl as acf - >>> example = acf.Start.builtin_challenge('1a') - >>> design = example.suggest_a_design() - >>> bridge = example.build_bridge(design, mapdl_version=231) - >>> success, feedback, beams = bridge.assess_for_breaks() - >>> success - False - >>> feedback - "..." -``` In the following example we do the same again but connect to a remote instance of MAPDL via the `Server` object. - -```python-repl - >>> import ansys.codefest.mapdl as acf - >>> example = acf.Start.builtin_challenge('1a', - server=acf.Server()) - >>> design = example.suggest_a_design() - >>> bridge = example.build_bridge(design) - >>> success, feedback, beams = bridge.assess_for_breaks() - >>> success - False - >>> feedback - "..." -``` - Materials can optionally be included in the design as a list of IDs (integers) that correspond to the list of beams. See all the materials available (and their IDs) by accessing the `acf.MATERIALS` dict. @@ -99,6 +83,31 @@ Materials can optionally be included in the design as a list of IDs (integers) t **Returns:** instantiated Bridge object, which can be used to gather results + + +**Examples:** + + +In the following examples we step through the whole simulation loop from start to finish. In Example 2 we connect to a server instead of a local connection. + +```python + # Example 1 + import ansys.codefest.mapdl as acf + example = acf.Start.builtin_challenge('1a') + design = example.suggest_a_design() + bridge = example.build_bridge(design, mapdl_version=231) + success, feedback, beams = bridge.assess_for_breaks() + print(feedback) # should print feedback as a string if no success + + # Example 2 + import ansys.codefest.mapdl as acf + example = acf.Start.builtin_challenge('1a', + server=acf.Server()) + design = example.suggest_a_design() + bridge = example.build_bridge(design) + success, feedback, beams = bridge.assess_for_breaks() +``` + --- ## method `BuildyMcBuildFace.calculate_design_cost` diff --git a/Markdown/ansys_codefest/ansys.codefest.mapdl.Challenge.md b/Markdown/ansys_codefest/ansys.codefest.mapdl.Challenge.md index 4a1f5999f2..e665dbf685 100644 --- a/Markdown/ansys_codefest/ansys.codefest.mapdl.Challenge.md +++ b/Markdown/ansys_codefest/ansys.codefest.mapdl.Challenge.md @@ -61,7 +61,7 @@ The file path to the story file. **Returns:** - ` the location of the story file as a pathlib Path + the location of the story file as a pathlib Path --- @@ -72,7 +72,7 @@ The suggestion file path. **Returns:** - ` the location of the suggestion json file as a pathlib Path + the location of the suggestion json file as a pathlib Path @@ -115,14 +115,14 @@ Create a Challenge instance from scratch. **Args:** - - `path_to_level`: path to where the level file should go - - `path_to_suggestion`: path to where the suggestion file should go - - `story_type`: what sort of instructions should be added to the challenge + - `path_to_level`: path to where the level file should go + - `path_to_suggestion`: path to where the suggestion file should go + - `story_type`: what sort of instructions should be added to the challenge **Returns:** - ` The new challenge instance + The new challenge instance --- @@ -141,13 +141,13 @@ Create a Challenge instance from a built-in an example. **Args:** - - `number`: aka ID. This will be something like `'8'` or `'1a'` - - `story_type`: what sort of instructions should be added to the challenge + - `number`: aka ID. This will be something like `'8'` or `'1a'` + - `story_type`: what sort of instructions should be added to the challenge **Returns:** - ` The new challenge instance + The new challenge instance --- diff --git a/Markdown/ansys_codefest/ansys.codefest.mapdl.CrossSection.md b/Markdown/ansys_codefest/ansys.codefest.mapdl.CrossSection.md index b016a52359..57214f2df4 100644 --- a/Markdown/ansys_codefest/ansys.codefest.mapdl.CrossSection.md +++ b/Markdown/ansys_codefest/ansys.codefest.mapdl.CrossSection.md @@ -2,7 +2,20 @@ # class `CrossSection` Beam cross-section details. -There are 4 cross-sections available: RECT - BeamXn.RECTANGLE HREC - BeamXn.RECTANGLETUBE CSOLID - BeamXn.CIRCLE CTUBE - BeamXn.CYLINDER +There are 4 cross-sections available.; + + + - RECT - BeamXn.RECTANGLE + - HREC - BeamXn.RECTANGLETUBE + - CSOLID - BeamXn.CIRCLE + - CTUBE - BeamXn.CYLINDER + + + +**Args:** + + - `shape`: Beam cross-section shape + - `dimensions`: Dimensions list to accompany the shape ### method `CrossSection.__init__` diff --git a/Markdown/ansys_codefest/ansys.codefest.mapdl.Simulation.md b/Markdown/ansys_codefest/ansys.codefest.mapdl.Simulation.md index 10c87f5a79..9bdf45d892 100644 --- a/Markdown/ansys_codefest/ansys.codefest.mapdl.Simulation.md +++ b/Markdown/ansys_codefest/ansys.codefest.mapdl.Simulation.md @@ -1,6 +1,20 @@ # class `Simulation` -Simulation class. Consumes 1 blueprint instance in order to perform = +Simulation class. Consumes 1 blueprint instance in order to perform. + +Most args are left as defaults and calculated during the building phase. + + + +**Args:** + + - `blueprint`: a blueprint object + - `nodes`: list of nodes to be simulated + - `beams`: list of beams to be simulated + - `mapdl`: base mapdl object (or existing session object) + - `mapdl_version`: version number if specific one is needed + - `mapdl_loc`: location on your harddrive of the mapdl executable if needed + - `server`: server url if connection to remote server needed. ### method `Simulation.__init__` diff --git a/Markdown/ansys_codefest/ansys.codefest.mapdl.StoryType.md b/Markdown/ansys_codefest/ansys.codefest.mapdl.StoryType.md index 1e147f14e1..6e9c9e3059 100644 --- a/Markdown/ansys_codefest/ansys.codefest.mapdl.StoryType.md +++ b/Markdown/ansys_codefest/ansys.codefest.mapdl.StoryType.md @@ -1,6 +1,11 @@ # class `StoryType` -The three types of story presentation ranging from least to most verbose. +The three types of story presentation ranging from least to most verbose. Integer Enum. + + +- MINIMAL = 0 +- CONCISE = 1 +- VERBOSE = 2 diff --git a/Markdown/ansys_codefest/ansys.codefest.mapdl.Submission.md b/Markdown/ansys_codefest/ansys.codefest.mapdl.Submission.md index e7f2e69106..91df8dda38 100644 --- a/Markdown/ansys_codefest/ansys.codefest.mapdl.Submission.md +++ b/Markdown/ansys_codefest/ansys.codefest.mapdl.Submission.md @@ -25,29 +25,31 @@ This class is a `typing.TypedDict` class that specifies the schema all dictionar **Examples:** -The suggested design for example 1a is shown below. ```python - design = {"nodes": [[3, -2, 1], - [4, -1, 1], - [5, 0, 1], - [6, 1, 1], - [7, 2, 1], - [8, 0, 0], - [9, 0, -1]], - "beams": [[1, 3], - [3, 4], - [4, 5], - [5, 6], - [6, 7], - [7, 2], - [5, 8], - [8, 9], - [9, 59]], - "load_path": [1, 3, 4, 5, 6, 7, 2], - "cross_section": [2, 2, 2, 2, 2, 2, 2, 2, 2], - "dimensions": [[0.025], [0.025], [0.025], [0.025], - [0.025], [0.025], [0.025], [0.025], - [0.025]], - "materials": [1, 1, 1, 1, 1, 1, 3, 3, 3]} +The suggested design for example 1a is shown below. + +``` + {"nodes": [[3, -2, 1], + [4, -1, 1], + [5, 0, 1], + [6, 1, 1], + [7, 2, 1], + [8, 0, 0], + [9, 0, -1]], + "beams": [[1, 3], + [3, 4], + [4, 5], + [5, 6], + [6, 7], + [7, 2], + [5, 8], + [8, 9], + [9, 59]], + "load_path": [1, 3, 4, 5, 6, 7, 2], + "cross_section": [2, 2, 2, 2, 2, 2, 2, 2, 2], + "dimensions": [[0.025], [0.025], [0.025], [0.025], + [0.025], [0.025], [0.025], [0.025], + [0.025]], + "materials": [1, 1, 1, 1, 1, 1, 3, 3, 3]} ``` diff --git a/Markdown/ansys_codefest/index.md b/Markdown/ansys_codefest/index.md index 80acf6f662..c2e2e538fa 100644 --- a/Markdown/ansys_codefest/index.md +++ b/Markdown/ansys_codefest/index.md @@ -25,6 +25,12 @@ Ansys Codefest Companion Library - Requires-Dist - ipython>=8.10.0 - Requires-Dist - ansys-mapdl-core>0.68.0 - Requires-Dist - jupyter>=1.0.0 +- Requires-Dist - pytest >=2.7.3 ; extra == "test" +- Requires-Dist - pytest-cov ; extra == "test" +- Requires-Dist - pre-commit ; extra == "test" +- Requires-Dist - pytest-rerunfailures ; extra == "test" +- Requires-Dist - pytest-cov ; extra == "test" +- Provides-Extra - test # Ansys CodeFest Companion Library