-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from openmsr/develop
Adds in a check for degenerate toroids in the input geometry
- Loading branch information
Showing
11 changed files
with
101 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[project] | ||
name="CAD_to_OpenMC" | ||
version="0.3.2" | ||
version="0.3.3a0" | ||
authors = [ | ||
{ name="Erik B Knudsen", email="[email protected]" }, | ||
] | ||
|
@@ -20,10 +20,8 @@ dependencies=[ | |
'cadquery>=2', | ||
'cadquery-ocp>=7', | ||
'numpy', | ||
'meshio', | ||
'trimesh', | ||
'networkx', | ||
'Cython' | ||
'trimesh', | ||
] | ||
|
||
[project.urls] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
gmsh | ||
pyparsing>=2.4 | ||
pyparsing | ||
cadquery>=2.2.0 | ||
cadquery-ocp>=7.7.0 | ||
numpy | ||
OCP | ||
meshio | ||
trimesh | ||
networkx | ||
Cython>=0.29.32 | ||
Cython |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#a set of function to report on input step-files | ||
import re | ||
|
||
def assemble_cmd(line,file): | ||
line=line.strip() | ||
while not line.endswith(';'): | ||
line=line+file.readline().strip() | ||
return line | ||
|
||
def parse_command(command): | ||
pattern='(#[0-9]+)\s*=\s*(\w+)\s*\((.*)\);' | ||
multipattern='(#[0-9]+)\s*=\s*\(((\w+)\s*\((.*)\))+\);' | ||
m=re.match(pattern,command) | ||
if(not m): | ||
m=re.match(multipattern,command) | ||
if (not m): | ||
return None | ||
return m.groups() | ||
|
||
degen_pattern=r'(#\d+)=DEGENERATE_TOROIDAL_SURFACE\(\'.*\',(#\d+),([-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?),([-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?),\.([TFtf])\.' | ||
|
||
def has_degenerate_toroids(infile='geometry.step', only_known_fail=False): | ||
dtors=[] | ||
with open(infile,'r') as f: | ||
for line in f: | ||
m=re.search(degen_pattern,line) | ||
if m: | ||
dtors.append(m.groups()) | ||
|
||
if only_known_fail: | ||
#remove those toroids which we know work - i.e. those where select outer is true | ||
for tor in dtors: | ||
r_maj, r_min = tor[2:4] | ||
if tor[4] in ['F','f']: | ||
outer=False | ||
else: | ||
outer=True | ||
if r_maj > 2*r_min or not outer: | ||
dtors.remove(tor) | ||
if len(dtors)>0: | ||
return True, len(dtors) | ||
else: | ||
return False, 0 |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters