• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

haiiliin / abqpy / 11091603440

29 Sep 2024 09:40AM UTC coverage: 74.293% (-0.004%) from 74.297%
11091603440

Pull #5816

github

web-flow
Merge c5ab97e94 into 2e02a2ebf
Pull Request #5816: Fix some type hint errors

20 of 24 new or added lines in 8 files covered. (83.33%)

246 existing lines in 4 files now uncovered.

25386 of 34170 relevant lines covered (74.29%)

0.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

78.13
/src/abaqus/StepOutput/OutputModel.py
1
from __future__ import annotations
1✔
2

3
from typing import TYPE_CHECKING, Sequence, Union
1✔
4

5
from typing_extensions import Literal
1✔
6

7
from abqpy.decorators import abaqus_class_doc, abaqus_method_doc
1✔
8

9
from ..Model.ModelBase import ModelBase
1✔
10
from ..Region.Region import Region
1✔
11
from ..UtilityAndView.abaqusConstants import (
1✔
12
    ALL,
13
    DEFAULT,
14
    EVERY_TIME_INCREMENT,
15
    EXCLUDE,
16
    INDEPENDENT,
17
    INTEGRATION_POINTS,
18
    J_INTEGRAL,
19
    MODEL,
20
    MTS,
21
    OFF,
22
    ON,
23
    PRESELECT,
24
    SPECIFIED,
25
    Boolean,
26
    SymbolicConstant,
27
)
28
from ..UtilityAndView.abaqusConstants import abaqusConstants as C
1✔
29
from .FieldOutputRequest import FieldOutputRequest
1✔
30
from .HistoryOutputRequest import HistoryOutputRequest
1✔
31
from .IntegratedOutputSection import IntegratedOutputSection
1✔
32
from .TimePoint import TimePoint
1✔
33

34
if TYPE_CHECKING:
1✔
NEW
35
    from numpy.typing import NDArray
×
36

37

38
@abaqus_class_doc
1✔
39
class OutputModel(ModelBase):
1✔
40
    """Abaqus creates a Model object named `Model-1` when a session is started.
41

42
    .. note::
43
        This object can be accessed by::
44

45
            mdb.models[name]
46
    """
47

48
    @abaqus_method_doc
1✔
49
    def FieldOutputRequest(
1✔
50
        self,
51
        name: str,
52
        createStepName: str,
53
        region: Union[Literal[C.MODEL], Region] = MODEL,
54
        variables: Union[Sequence[str], Literal[C.PRESELECT, C.ALL]] = PRESELECT,
55
        frequency: Union[int, Literal[C.LAST_INCREMENT]] = 1,
56
        modes: Union[Literal[C.ALL], Sequence[int]] = ALL,
57
        timeInterval: Union[Literal[C.EVERY_TIME_INCREMENT], float] = EVERY_TIME_INCREMENT,
58
        numIntervals: int = 20,
59
        timeMarks: Boolean = OFF,
60
        timePoint: str | None = None,
61
        boltLoad: str = "",
62
        sectionPoints: Union[Literal[C.DEFAULT], Sequence[int]] = DEFAULT,
63
        interactions: str | None = None,
64
        rebar: Literal[C.EXCLUDE, C.INCLUDE, C.ONLY] = EXCLUDE,
65
        filter: Literal[C.ANTIALIASING] | None = None,
66
        directions: Boolean = ON,
67
        fasteners: str = "",
68
        assembledFastener: str = "",
69
        assembledFastenerSet: str = "",
70
        exteriorOnly: Boolean = OFF,
71
        layupNames: str = "",
72
        layupLocationMethod: str = SPECIFIED,
73
        outputAtPlyTop: Boolean = False,
74
        outputAtPlyMid: Boolean = True,
75
        outputAtPlyBottom: Boolean = False,
76
        position: Literal[C.INTEGRATION_POINTS, C.AVERAGED_AT_NODES, C.CENTROIDAL, C.NODES] = INTEGRATION_POINTS,
77
    ) -> FieldOutputRequest:
78
        """This method creates a FieldOutputRequest object.
79

80
        .. note::
81
            This function can be accessed by::
82

83
                mdb.models[name].FieldOutputRequest
84

85
        Parameters
86
        ----------
87
        name
88
            A String specifying the repository key.
89
        createStepName
90
            A String specifying the name of the step in which the object is created.
91
        region
92
            The SymbolicConstant MODEL or a Region object specifying the region from which output is
93
            requested. The SymbolicConstant MODEL represents the whole model. The default value is
94
            MODEL.
95
        variables
96
            A sequence of Strings specifying output request variable or component names, or the
97
            SymbolicConstant PRESELECT or ALL. PRESELECT represents all default output variables for
98
            the given step. ALL represents all valid output variables. The default value is
99
            PRESELECT.
100
        frequency
101
            The SymbolicConstant LAST_INCREMENT or an Int specifying the output frequency in
102
            increments. The default value is 1.
103
        modes
104
            The SymbolicConstant ALL or a sequence of Ints specifying a list of eigenmodes for which
105
            output is desired. The default value is ALL.
106
        timeInterval
107
            The SymbolicConstant EVERY_TIME_INCREMENT or a Float specifying the time interval at
108
            which the output states are to be written. The default value is EVERY_TIME_INCREMENT.
109
        numIntervals
110
            An Int specifying the number of intervals during the step at which output database
111
            states are to be written. The default value is 20.
112
        timeMarks
113
            A Boolean specifying when to write results to the output database. OFF indicates that
114
            output is written immediately after the time dictated by the specified number of
115
            intervals. ON indicates that output is written at the exact times dictated by the
116
            specified number of intervals. The default value is OFF.
117
        timePoint
118
            A String specifying the name of a time point object. The default value is equal to
119
            the number of intervals during the step at which output database states are to be
120
            written. The default value is None.
121
        boltLoad
122
            A String specifying a bolt load from which output is requested.
123
        sectionPoints
124
            The SymbolicConstant DEFAULT or a sequence of Ints specifying the section points for
125
            which output requested. The default is DEFAULT.
126
        interactions
127
            None or a sequence of Strings specifying the interaction names. The default value is
128
            None.The sequence can contain only one String.
129
        rebar
130
            A SymbolicConstant specifying whether output is requested for rebar. Possible values are
131
            EXCLUDE, INCLUDE, and ONLY. The default value is EXCLUDE.
132
        filter
133
            The SymbolicConstant ANTIALIASING or a String specifying the name of an output filter
134
            object. The default value is None.
135
        directions
136
            A Boolean specifying whether to output directions of the local material coordinate
137
            system. The default value is ON.
138
        fasteners
139
            A String specifying the fastener name. The default value is an empty string.
140
        assembledFastener
141
            A String specifying the assembled fastener name. The default value is an empty string.
142
        assembledFastenerSet
143
            A String specifying the set name from the model referenced by the assembled fastener,
144
            **assembledFastener**. The default value is an empty string.
145
        exteriorOnly
146
            A Boolean specifying whether the output domain is restricted to the exterior of the
147
            model. This argument is only valid if **region** = MODEL. The default value is OFF.
148
        layupNames
149
            A List of Composite Layer Names.
150
        layupLocationMethod
151
            A Symbolic constant specifying the method used to indicate the output locations for
152
            composite layups. Possible values are ALL_LOCATIONS, SPECIFIED and TYPED_IN. The default
153
            value is SPECIFIED.
154
        outputAtPlyTop
155
            A Boolean specifying whether to output at the ply top section point. The default value
156
            is False.
157
        outputAtPlyMid
158
            A Boolean specifying whether to output at the ply mid section point. The default value
159
            is True.
160
        outputAtPlyBottom
161
            A Boolean specifying whether to output at the ply bottom section point. The default
162
            value is False.
163
        position
164
            A SymbolicConstant specifying the position on an element where output needs to be
165
            written. Possible values are INTEGRATION_POINTS, AVERAGED_AT_NODES, CENTROIDAL, and
166
            NODES. The default value is INTEGRATION_POINTS.
167

168
        Returns
169
        -------
170
        FieldOutputRequest
171
            A FieldOutputRequest object.
172
        """
173
        self.fieldOutputRequests[name] = FieldOutputRequest(
1✔
174
            name,
175
            createStepName,
176
            region,
177
            variables,
178
            frequency,
179
            modes,
180
            timeInterval,
181
            numIntervals,
182
            timeMarks,
183
            timePoint,
184
            boltLoad,
185
            sectionPoints,
186
            interactions,
187
            rebar,
188
            filter,
189
            directions,
190
            fasteners,
191
            assembledFastener,
192
            assembledFastenerSet,
193
            exteriorOnly,
194
            layupNames,
195
            layupLocationMethod,
196
            outputAtPlyTop,
197
            outputAtPlyMid,
198
            outputAtPlyBottom,
199
            position,
200
        )
201
        return self.fieldOutputRequests[name]
1✔
202

203
    @abaqus_method_doc
1✔
204
    def HistoryOutputRequest(
1✔
205
        self,
206
        name: str,
207
        createStepName: str,
208
        region: Union[Literal[C.MODEL], Region] = MODEL,
209
        variables: Union[Sequence[str], Literal[C.PRESELECT, C.ALL]] = PRESELECT,
210
        frequency: Union[int, Literal[C.LAST_INCREMENT]] = 1,
211
        modes: Union[Literal[C.ALL], Sequence[int]] = ALL,
212
        timeInterval: Union[Literal[C.EVERY_TIME_INCREMENT], float] = EVERY_TIME_INCREMENT,
213
        numIntervals: int = 20,
214
        boltLoad: str = "",
215
        sectionPoints: Union[Literal[C.DEFAULT], Sequence[int]] = DEFAULT,
216
        stepName: str = "",
217
        interactions: str | None = None,
218
        contourIntegral: str | None = None,
219
        numberOfContours: int = 0,
220
        stressInitializationStep: str | None = None,
221
        contourType: Literal[C.J_INTEGRAL, C.C_INTEGRAL, C.T_STRESS, C.K_FACTORS] = J_INTEGRAL,
222
        kFactorDirection: Literal[C.MTS, C.MERR, C.K110] = MTS,
223
        rebar: Literal[C.EXCLUDE, C.INCLUDE, C.ONLY] = EXCLUDE,
224
        integratedOutputSection: str = "",
225
        springs: tuple | None = None,
226
        filter: Literal[C.ANTIALIASING] | None = None,
227
        fasteners: str = "",
228
        assembledFastener: str = "",
229
        assembledFastenerSet: str = "",
230
        sensor: Boolean = OFF,
231
        useGlobal: Boolean = True,
232
    ) -> HistoryOutputRequest:
233
        """This method creates a HistoryOutputRequest object.
234

235
        .. note::
236
            This function can be accessed by::
237

238
                mdb.models[name].HistoryOutputRequest
239

240
        Parameters
241
        ----------
242
        name
243
            A String specifying the repository key.
244
        createStepName
245
            A String specifying the name of the step in which the object is created.
246
        region
247
            The SymbolicConstant MODEL or a Region object specifying the region from which output is
248
            requested. The SymbolicConstant MODEL represents the whole model. The default value is
249
            MODEL. If the region is a surface region, the surface must lie within the general contact
250
            surface domain.
251
        variables
252
            A sequence of Strings specifying output request variable or component names, or the
253
            SymbolicConstant PRESELECT or ALL. PRESELECT represents all default output variables for
254
            the given step. ALL represents all valid output variables. The default value is
255
            PRESELECT.
256
        frequency
257
            The SymbolicConstant LAST_INCREMENT or an Int specifying the output frequency in
258
            increments. The default value is 1.
259
        modes
260
            The SymbolicConstant ALL or a sequence of Ints specifying a list of eigenmodes for which
261
            output is desired. The default value is ALL.
262
        timeInterval
263
            The SymbolicConstant EVERY_TIME_INCREMENT or a Float specifying the time interval at
264
            which the output states are to be written. The default value is EVERY_TIME_INCREMENT.
265
        numIntervals
266
            An Int specifying the number of intervals during the step at which output database
267
            states are to be written. The default value is 20.
268
        boltLoad
269
            A String specifying a bolt load from which output is requested. The default value is an
270
            empty string.
271
        sectionPoints
272
            The SymbolicConstant DEFAULT or a sequence of Ints specifying the section points for
273
            which output is requested. The default value is DEFAULT.
274
        stepName
275
            A String specifying the name of the step. The default value is an empty string.
276
        interactions
277
            None or a sequence of Strings specifying the interaction names. The default value is
278
            None.The sequence can contain only one String.
279
        contourIntegral
280
            A String specifying the contour integral name. The default value is None.
281
        numberOfContours
282
            An Int specifying the number of contour integrals to output for the contour integral
283
            object. The default value is 0.
284
        stressInitializationStep
285
            A String specifying the name of the stress initialization step. The default value is
286
            None.
287
        contourType
288
            A SymbolicConstant specifying the type of contour integral. Possible values are
289
            J_INTEGRAL, C_INTEGRAL, T_STRESS, and K_FACTORS. The default value is J_INTEGRAL.
290
        kFactorDirection
291
            A SymbolicConstant specifying the stress intensity factor direction. Possible values are
292
            MTS, MERR, and K110. The **kFactorDirection** argument is valid only if
293
            **contourType** = K_FACTORS. The default value is MTS.
294
        rebar
295
            A SymbolicConstant specifying whether output is requested for rebar. Possible values are
296
            EXCLUDE, INCLUDE, and ONLY. The default value is EXCLUDE.
297
        integratedOutputSection
298
            A String specifying the integrated output section. The default value is an empty string.
299
        springs
300
            A sequence of Strings specifying the springs/dashpots names. The default value is None.
301
            The sequence can contain only one String.
302
        filter
303
            The SymbolicConstant ANTIALIASING or a String specifying the name of an output filter
304
            object. The default value is None.
305
        fasteners
306
            A String specifying the fastener name. The default value is an empty string.
307
        assembledFastener
308
            A String specifying the assembled fastener name. The default value is an empty string.
309
        assembledFastenerSet
310
            A String specifying the set name from the model referenced by the assembled fastener,
311
            **assembledFastener**. The default value is an empty string.
312
        sensor
313
            A Boolean specifying whether to associate the output request with a sensor definition.
314
            The default value is OFF.
315
        useGlobal
316
            A Boolean specifying whether to output vector-valued nodal variables in the global
317
            directions. The default value is True.
318

319
        Returns
320
        -------
321
        HistoryOutputRequest
322
            A HistoryOutputRequest object.
323
        """
UNCOV
324
        self.historyOutputRequests[name] = HistoryOutputRequest(
×
325
            name,
326
            createStepName,
327
            region,
328
            variables,
329
            frequency,
330
            modes,
331
            timeInterval,
332
            numIntervals,
333
            boltLoad,
334
            sectionPoints,
335
            stepName,
336
            interactions,
337
            contourIntegral,
338
            numberOfContours,
339
            stressInitializationStep,
340
            contourType,
341
            kFactorDirection,
342
            rebar,
343
            integratedOutputSection,
344
            springs,
345
            filter,
346
            fasteners,
347
            assembledFastener,
348
            assembledFastenerSet,
349
            sensor,
350
            useGlobal,
351
        )
UNCOV
352
        return self.historyOutputRequests[name]
×
353

354
    @abaqus_method_doc
1✔
355
    def IntegratedOutputSection(
1✔
356
        self,
357
        name: str,
358
        surface: Region,
359
        refPoint: SymbolicConstant | None = None,
360
        refPointAtCenter: Boolean = OFF,
361
        refPointMotion: Literal[C.AVERAGE_TRANSLATION, C.AVERAGE, C.INDEPENDENT] = INDEPENDENT,
362
        localCsys: str | None = None,
363
        projectOrientation: Boolean = OFF,
364
    ) -> IntegratedOutputSection:
365
        """This method creates an IntegratedOutputSection object.
366

367
        .. note::
368
            This function can be accessed by::
369

370
                mdb.models[name].IntegratedOutputSection
371

372
        Parameters
373
        ----------
374
        name
375
            A String specifying the repository key.
376
        surface
377
            A Region object specifying the surface over which the output is based.
378
        refPoint
379
            None or a Region object specifying the anchor point about which the integrated moment
380
            over the output region is computed or the SymbolicConstant None representing the global
381
            origin. The default value is None.
382
        refPointAtCenter
383
            A Boolean specifying that the **refPoint** be adjusted so that it coincides with the
384
            center of the output region in the initial configuration. This argument is valid only
385
            when you include the **refPoint** argument. The default value is OFF.
386
        refPointMotion
387
            A SymbolicConstant specifying how to relate the motion of **refPoint** to the average
388
            motion of the output region. A value of INDEPENDENT will allow the **refPoint** to move
389
            independent of the output region. A value of AVERAGE_TRANSLATION will set the
390
            displacement of the **refPoint** equal to the average translation of the output region. A
391
            value of AVERAGE will set the displacement and rotation of the **refPoint** equal to the
392
            average translation of the output region. The default value is INDEPENDENT.This argument
393
            is valid only when you include the **refPoint** argument.
394
        localCsys
395
            None or a DatumCsys object specifying the local coordinate system used to express vector
396
            output. If **localCsys** = None, the degrees of freedom are defined in the global coordinate
397
            system. The default value is None.
398
        projectOrientation
399
            A Boolean specifying that the coordinate system be projected onto the **surface** such
400
            that the 1-axis is normal to the **surface**. Projection onto a planar **surface** is such
401
            that the 1-axis is normal to the surface, and a projection onto a nonplanar **surface** is
402
            such that a least-squares fit surface will be used. The default value is OFF.
403

404
        Returns
405
        -------
406
        IntegratedOutputSection
407
            An IntegratedOutputSection object.
408
        """
UNCOV
409
        self.integratedOutputSections[name] = integratedOutputSection = IntegratedOutputSection(
×
410
            name,
411
            surface,
412
            refPoint,
413
            refPointAtCenter,
414
            refPointMotion,
415
            localCsys,
416
            projectOrientation,
417
        )
418
        return integratedOutputSection
×
419

420
    @abaqus_method_doc
1✔
421
    def TimePoint(self, name: str, points: tuple | NDArray) -> TimePoint:
1✔
422
        """This method creates a TimePoint object.
423

424
        .. note::
425
            This function can be accessed by::
426

427
                mdb.models[name].TimePoint
428

429
        Parameters
430
        ----------
431
        name
432
            A String specifying the repository key.
433
        points
434
            A sequence of sequences of Floats specifying time points at which data are written to
435
            the output database or restart files.
436

437
        Returns
438
        -------
439
        TimePoint
440
            A TimePoint object.
441

442
        Raises
443
        ------
444
        InvalidNameError
445
        RangeError
446
        """
UNCOV
447
        self.timePoints[name] = timePoint = TimePoint(name, points)
×
UNCOV
448
        return timePoint
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc