BasicTools.Containers.UnstructuredMesh module

class BasicTools.Containers.UnstructuredMesh.AllElements[source]

Bases: object

Class to store a list of element containers This class is a sorted by keys dictioniary to keep all the always in order

Note

FB: the number of different types of elements is low, I don’t think this is gonna add alot of overhead to the library

GetElementsOfType(typename)[source]
GetTagsNames()[source]
items()[source]
keys()[source]
values()[source]
BasicTools.Containers.UnstructuredMesh.CheckIntegrity()[source]
class BasicTools.Containers.UnstructuredMesh.ElementsContainer(elementType)[source]

Bases: BaseOutputObject

Class to hold a list of element of the same type

  • elementType : a string form BasicTools.Containers.ElementNames

  • connectivity : the connectivity matrix starting form 0

  • tags : the tags holder class

  • originalIds : the id or number from the previous mesh/file

The user can use this data to find the mapping from the inintial mesh/file to the currect mesh (self).

  • self.globaloffset : this value is calculate automaticaly by the mesh

  • self.cpt : an internal counter to do efficient add of elements one by one

The user is responsible to call self.tighten() to compact the connectivity matrix after the population ( calls AddNewElement(…) or allocate(…))

AddElementToTag(globalElemNumber, tagname)[source]

Add an element to a tag using a global element number The user must compute the globaloffset first to make this function work

AddNewElement(conn, originalid)[source]

append a new element to the connectivity

inputs: conn : connectivity of the added element originalid : the original id of the added element

return the total number of elements in the container

AddNewElements(conn, originalids=None)[source]

append a new element to the connectivity

inputs: conn : connectivity of the added element originalid : the original id of the added element

return the total number of elements in the container

Allocate(nbElements)[source]

Allocate the storage for nbElements

the user is responsible of filling the connectivity and the originalid with valid values

GetNodesIdFor(ids)[source]

return the nodes used by the list of elements

input:

ids : list of ids of element to treat (always a local id list)

GetNumberOfElements()[source]

return the number of elements in this container

GetNumberOfNodesPerElement()[source]

return the number of nodes per element for the elements in this container

GetTag(tagName)[source]

return the tag based is a name if the tag does not exist a new tag is created

Merge(other, offset=None)[source]

Merge the elements from the other container into this.

Non elimination of double elements is done

if an offset is supplied the connectivity of the other container is shifted by the value of the offset during the merge

Reserve(nbElements)[source]

Reserve the storage for nbElements

the user is responsible to call self.tighten() to compact the connectivity matrix after the population

tighten()[source]

to compact the storage an free non used space

class BasicTools.Containers.UnstructuredMesh.UnstructuredMesh[source]

Bases: MeshBase

Class storing an unstructured (i.e. general) mesh:

  • self.nodes : the points positions

  • self.orignilaIdNodes : the ids of the previous mesh/file

  • self.elements : the list of all the elememnt in the mesh

  • self.boundingMin/Max : the bounding box of the mesh (use ComputeBoundingBox to compute it)

The manual construction of this class must always end with a call to the function.

AddElementToTag(globalElemNumber, tagname)[source]

add a element (using the global element number) to a tag (tagname) # you must compute the globaloffset first to make this function work

AddElementToTagUsingOriginalId(oid, tagname)[source]

add a element (using the originalid) to a tag (tagname)

AddElementsToTag(globalElemNumbers, tagname)[source]

add elements (using the global element number) to a tag (tagname) # you must compute the globaloffset first to make this function work

AddNodeToTagUsingOriginalId(oid, tagname)[source]

add a node (using the original id ) to a tag (tagname)

Clean() None[source]

Remove superflu data : 1) empty tags 2) empty element containers

ComputeBoundingBox()[source]

to recumpute the bounding box

ComputeGlobalOffset() Dict[str, int64][source]

Recompute the Global Offset, This is necessary for some operation. Recomendation : Call it after changing the topology

ConvertDataForNativeTreatment()[source]
DeleteElemTags(tagNames)[source]

delete element tags

GetDimensionality()[source]

DEPRECATED: please use GetPointsDimensionality()

return the dimensionality 2/3

GetElementsInTag(tagname, useOriginalId=False)[source]

return a list with the ids of the elements in a tag The user must compute the globaloffset first to make this function work

GetElementsOriginalIDs(dim=None)[source]

return a single list with all the originalid concatenated

GetNumberOfElements(dim=None)[source]

Compute and return the total number of elements in the mesh

GetNumberOfNodes()[source]

return the total number of nodes in the mesh

GetPointsDimensionality() int[source]

Return the number of coordinates of the points

Returns:

number of columns in the point array

Return type:

int

GetPosOfNode(i)[source]

return the position of the point i

GetPosOfNodes()[source]

return the position of all the nodes

IsUnstructured()[source]
MergeElements(other, force=False)[source]

Merge the element for a second mesh into this the nodes array must be the same (not only equal)

the user can force the merge if needed (force variable)

PrepareForOutput()[source]

function to free the extra memory used during a incremental creation of a mesh and final treatement (offset computation)

SetElementsOriginalIDs(originalIDs)[source]

Set from a single list all the originalid

SetNodes(arrayLike, originalIDNodes=None, generateOriginalIDs=False)[source]

Set nodes and original Ids in the correct internal data

VerifyIntegrity()[source]