Skip to content

Commit

Permalink
Handle periodic boundaries and partitions in gmsh v2 format
Browse files Browse the repository at this point in the history
  • Loading branch information
jaabell committed Feb 7, 2020
1 parent ff5fccd commit 871698f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion gmshtranslator/gmshtranslator.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def __init__(self, mshfilename):
self.physical_group_names = {}
self.Periodic_nodes = []
self.i_periodic = 0
self.maxNodeTag = -1

linenumber = 1
for line in self.mshfid:
Expand Down Expand Up @@ -89,8 +90,13 @@ def __init__(self, mshfilename):
self.Nnodes = sp.int32(line)
self.__inform__("Mesh has " + str(self.Nnodes) + " nodes.")
reading_nodes = 2
self.maxNodeTag = -1
# self.node_partitions = [[] for dum in range(self.Nnodes+1)]
continue

if reading_nodes == 2:
tag = sp.int32(line.split()[0])
self.maxNodeTag = max(self.maxNodeTag, tag)

#If this is the first line of elements, read the number of elements
if reading_elements == 1:
Expand Down Expand Up @@ -141,7 +147,7 @@ def __init__(self, mshfilename):
if physgrp in self.physical_groups:
self.nodes_in_physical_groups[physgrp][nodelist] = 1
else:
self.nodes_in_physical_groups[physgrp] = -sp.ones(self.Nnodes+1, dtype=sp.int16)
self.nodes_in_physical_groups[physgrp] = -sp.ones(self.maxNodeTag+1, dtype=sp.int16)
self.nodes_in_physical_groups[physgrp][nodelist] = 1
self.physical_groups.append(physgrp)
pass
Expand Down

0 comments on commit 871698f

Please sign in to comment.