Scoping

class ansys.dpf.core.scoping.Scoping(scoping=None, server=None, ids=None, location=None)

A class used to represent a Scoping which is a subset of a model support.

Parameters
  • scoping (ansys.grpc.dpf.scoping_pb2.Scoping message, optional) –

  • server (DPFServer, optional) – Server with channel connected to the remote or local instance. When None, attempts to use the the global server.

ids
Type

list of int

location

Location of the ids. For example "Nodal" or "Elemental".

Type

str

Examples

Create a mesh scoping

>>> from ansys.dpf import core as dpf
>>> # 1. using the mesh_scoping_factory
>>> from ansys.dpf.core import mesh_scoping_factory
>>> # a. scoping with elemental location that targets the elements with id 2, 7 and 11
>>> my_elemental_scoping = mesh_scoping_factory.elemental_scoping([2, 7, 11])
>>> # b. scoping with nodal location that targets the elements with id 4 and 6
>>> my_nodal_scoping = mesh_scoping_factory.nodal_scoping([4, 6])
>>> #2. using the classic API
>>> my_scoping = dpf.Scoping()
>>> my_scoping.location = "Nodal" #optional
>>> my_scoping.ids = list(range(1,11))
set_id(index, scopingid)

Set the id of an index of the scoping

Parameters
  • index (int) –

  • scopingid (int) –

id(index: int)

Get the id at a given index

Returns

size

Return type

int

index(id: int)

Get the index of a given id

Returns

size

Return type

int

property ids

Get the list of ids in the scoping

Returns

ids

Return type

list of int

Notes

Print a progress bar

property location

The location of the ids as a string (e.g. nodal, elemental, time_freq, etc…)

Returns

location

Return type

str

property size

length of the ids list

Returns

size

Return type

int

deep_copy(server=None)

Creates a deep copy of the scoping’s data on a given server. This can be useful to pass data from one server instance to another.

Parameters

server (DPFServer, optional) – Server with channel connected to the remote or local instance. When None, attempts to use the the global server.

Returns

scoping_copy

Return type

Scoping