hertzforge.compatibility¶
compatibility
¶
Check that the objects in a test belong together.
Everything that carries DOFs (mode shapes, data records, channel table rows) names nodes, and this module checks those nodes against the geometry each object answers to. An object that names nodes the geometry does not have is reported, and the app marks it red. It can still be linked: a test often has drive points, control coordinates or virtual channels the model does not draw. Mode shapes from one structure beside the geometry of another are reported the same way, and the person reading the indicator can tell the two cases apart.
An object answers to its object group's geometry when the group has one, so a FEM shape set linked with its own FEM mesh is consistent whichever geometry is active. Otherwise it answers to the active geometry, so a test holding two models still gives one answer for each object. Objects with no DOFs (a geometry itself) are never flagged. With no geometry in the project only modal objects (below) are checked, so importing data before its geometry does not mark everything red.
A data object whose DOFs are all modal coordinates (M1 ... Mn, see
validate.modal_coordinate) names no node. It answers to a shape set,
the one it was transformed or computed through, and fits wherever there
is a set with at least as many modes as it names: a set in its object
group when it is in one, any set in the project otherwise. A time
history can hold both kinds of record, forces merged with the modal
responses computed from them: its physical records answer to the
geometry and its modal records to the shape sets, each by its own rule.
Not checked here:
- units, which have their own indicator
- direction: a geometry does not restrict directions, so 101RX+ is fine wherever node 101 exists
- whether two data objects can be compared with each other
Classes:
| Name | Description |
|---|---|
Issue |
Why one object does not fit the geometry or shape set it answers to. |
Report |
The result of |
Functions:
| Name | Description |
|---|---|
modal_object |
The highest mode a data object's coordinates name, when every |
modal_records |
The records of a data object at modal coordinates; empty for |
check_modal |
The Issue for a modal object against the shape sets among its |
blocks_a_link |
Whether an issue is reason to refuse a link. |
check_object |
The Issue for one object against a geometry, or None if it fits. |
check_compatibility |
Check every object in a test against the geometry it answers to. |
Classes¶
Issue
dataclass
¶
Why one object does not fit the geometry or shape set it answers to.
kind is 'dofs-not-in-geometry', 'modes-not-in-set' (an object of
modal coordinates alone), or 'modes-beyond-set' (modal records beside
physical ones, the physical ones fitting). missing_dofs lists the
DOFs at fault, and sub_items the indices of the records, shapes or
channels that name them.
Report
dataclass
¶
The result of check_compatibility: an Issue for each object
that does not fit, by name, and the geometry the rest were judged
against.
Methods:
| Name | Description |
|---|---|
is_compatible |
Whether one object fits the geometry or shape set it answers to. |
issue_for |
What is wrong with one object, or None if nothing is. |
sub_item_flagged |
Whether one record, shape or channel within an object is |
Attributes:
| Name | Type | Description |
|---|---|---|
incompatible_names |
list[str]
|
The names of the objects that have an issue, which the tree |
Attributes¶
incompatible_names
property
¶
The names of the objects that have an issue, which the tree marks in red.
Methods:¶
is_compatible
¶
Whether one object fits the geometry or shape set it answers to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The object to ask about. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True when no issue was found for it. |
issue_for
¶
issue_for(name: str) -> Issue | None
What is wrong with one object, or None if nothing is.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The object to ask about. |
required |
Returns:
| Type | Description |
|---|---|
Issue or None
|
What is wrong with it, or None if nothing is. |
sub_item_flagged
¶
Whether one record, shape or channel within an object is flagged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The object to ask about. |
required |
index
|
int
|
Its index within the object. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True when that item names a DOF the geometry lacks, or a mode no shape set has. |
Functions:¶
modal_object
¶
The highest mode a data object's coordinates name, when every one of its DOFs is a modal coordinate, else None.
modal_records
¶
The records of a data object at modal coordinates; empty for anything else.
check_modal
¶
check_modal(name: str, obj: Any, companions: Mapping[str, Any]) -> Issue | None
The Issue for a modal object against the shape sets among its companions, or None when one of them has every mode it names.
The Issue's kind is 'modes-not-in-set', and its sub_items are the
records that name a mode beyond the largest set. A mixed object's
physical records name no mode and are never among them.
blocks_a_link
¶
blocks_a_link(issue: Issue | None) -> bool
Whether an issue is reason to refuse a link.
Naming nodes the geometry lacks is not. It is reported in red by the compatibility indicator and the link goes ahead, because a test names places the model does not draw as a matter of course: drive points, control coordinates, computed locations, virtual channels. A controller's control object and a mode shape from another structure look the same from here, and only the person reading the indicator can tell them apart.
What blocks is a modal object with no shape set that has as many
modes as it names, since it has nothing to be drawn against in any
geometry. A time history holding modal records beside physical ones
does not block: its physical records are drawn, and the shortfall of
its modal ones is reported ('modes-beyond-set'). (Project.link refuses two geometries in one group before
this is called.)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
issue
|
Issue or None
|
An object's issue, from |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True for a 'modes-not-in-set' issue, False for None or any other kind. |
check_object
¶
check_object(name: str, obj: Any, geometry: Geometry | None, geometry_name: str = 'the active geometry', companions: Mapping[str, Any] | None = None) -> Issue | None
The Issue for one object against a geometry, or None if it fits.
A geometry, an object of a type that names no DOFs, and any
non-modal object when geometry is None all return None.
companions are the objects it is grouped with: a modal object is
checked against the shape sets among them instead of the geometry.
geometry_name is used only in the message.
check_compatibility
¶
check_compatibility(objects: Mapping[str, Any], geometry_name: str | None = None, object_groups: Sequence[Mapping[str, Any]] | None = None) -> Report
Check every object in a test against the geometry it answers to.
An object linked into a group that holds a geometry is judged
against that geometry, so a FEM shape set beside its own FEM mesh is
consistent whichever geometry is active. Everything else is judged
against geometry_name. A modal object is judged against the shape
sets in its group, or against every set in the project when it is
not linked.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
objects
|
Mapping[str, Any]
|
The test's objects, by name. |
required |
geometry_name
|
str
|
The geometry everything not linked to one is judged against,
normally the active geometry. When it is omitted or names no
geometry in |
None
|
object_groups
|
sequence of Mapping
|
The project's object groups, which say which geometry each object answers to. |
None
|
Returns:
| Type | Description |
|---|---|
Report
|
What is consistent and what is not, object by object. |