8 parser = argparse.ArgumentParser(description=
'convert files by adding cell centroids and ID (for cubed-sphere)')
9 parser.add_argument(
'--porder', dest=
'porder', type=
int,
default=3, help=
'polynomial degree for basis')
10 parser.add_argument(
'--grids', dest=
'grids', type=
int,
default=2, help=
'number of grids for refinement sequence')
11 parser.add_argument(
'--solver-type', dest=
'solver_type', type=
int,
default=1, help=
'solver type (int)')
12 parser.add_argument(
'--in-trilinos', dest=
'in_trilinos', type=
str,
default=
'false', help=
'whether being called from inside of Trilinos')
15 def check_bounds(
porder, rate):
17 if rate<3 and rate>.9:
30 solver_type = args.solver_type
34 target_operators=(
"Tangent Bundle",
"Point Value",
"Laplace-Beltrami",
"Gaussian Curvature",
"Surface Gradient \(Ambient\)",
"Surface Vector \(VectorBasis\)",
"Surface Divergence \(VectorBasis\)",
"Surface Vector \(ScalarClones\)",
"Surface Divergence \(ScalarClones\)")#,
"Surface Gradient (Manifold)",
35 for operator in target_operators:
38 for grid_num in range(grids):
39 with open(os.devnull,
'w') as devnull:
41 if args.in_trilinos.lower()==
"true":
42 exe_name =
"@CMAKE_CURRENT_BINARY_DIR@/Compadre_GMLS_Manifold_Test.exe"
44 exe_name =
"@CMAKE_CURRENT_BINARY_DIR@/GMLS_Manifold_Test"
46 print(output_commands)
47 output = subprocess.check_output(output_commands, stderr=devnull)
49 for key, operator in enumerate(target_operators):
50 m = re.search(
'(?<=%s Error: )[0-9]+\.?[0-9]*(?:[Ee]\ *-?\ *[0-9]+)?'%operator, output.decode(
'utf-8'))
52 errors[key].append(float(m.group(0)))
54 print(
"Program exited early. Regular expression search for error failed.")
59 for key, operator in enumerate(target_operators):
60 print(
"\n\n%s rates: porder:%s\n============="%(operator.replace(
'\\',
''),
porder))
61 for i in range(1,len(errors[key])):
62 if (errors[key][i]!=0):
63 rate = math.log(errors[key][i]/errors[key][i-1])/math.log(.5)
64 print(
str(rate) +
", " +
str(errors[key][i]) +
", " +
str(errors[key][i-1]))
65 assert(check_bounds(
porder, rate))
67 print(
"NaN - Division by zero")
import subprocess import os import re import math import sys import argparse parser
import subprocess import os import re import math import sys import argparse d d num_target_sites
if(some_conditions_for_a_user_defined_operation)
import subprocess import os import re import math import sys import argparse d porder
import subprocess import os import re import math import sys import argparse d d str(solver_type)