2 # *****************************************************************************
3 # Compadre: COMpatible PArticle Discretization and REmap Toolkit
5 # Copyright 2018 NTESS and the Compadre contributors.
6 # SPDX-License-Identifier: BSD-2-Clause
7 # *****************************************************************************
16 parser = argparse.ArgumentParser(description=
'convert files by adding cell centroids and ID (for cubed-sphere)')
17 parser.add_argument(
'--porder', dest=
'porder', type=
int,
default=3, help=
'polynomial degree for basis')
18 parser.add_argument(
'--grids', dest=
'grids', type=
int,
default=2, help=
'number of grids for refinement sequence')
19 parser.add_argument(
'--solver-type', dest=
'solver_type', type=
str,
default=
'QR', help=
'solver type {QR,LU}')
20 parser.add_argument(
'--in-trilinos', dest=
'in_trilinos', type=
str,
default=
'false', help=
'whether being called from inside of Trilinos')
23 def check_bounds(
porder, rate):
25 if rate<3 and rate>.9:
38 solver_type = args.solver_type
42 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)",
43 for operator in target_operators:
46 for grid_num in range(grids):
47 with open(os.devnull,
'w') as devnull:
49 if args.in_trilinos.lower()==
"true":
50 exe_name =
"@CMAKE_CURRENT_BINARY_DIR@/Compadre_GMLS_Manifold_Test.exe"
52 exe_name =
"@CMAKE_CURRENT_BINARY_DIR@/GMLS_Manifold_Test"
53 output_commands = [exe_name,
"--p",
"%d"%
porder,
"--nt",
"%d"%
num_target_sites,
"--d",
"3",
"--ns",
"%d"%(20*
num_target_sites*pow(4,grid_num)),
"--solver",
str(solver_type),
"--problem",
"MANIFOLD",
"@KOKKOS_THREADS_ARG@=4"]
54 print(output_commands)
55 output = subprocess.check_output(output_commands, stderr=devnull)
57 for key, operator in enumerate(target_operators):
58 m = re.search(
'(?<=%s Error: )[0-9]+\.?[0-9]*(?:[Ee]\ *-?\ *[0-9]+)?'%operator, output.decode(
'utf-8'))
60 errors[key].append(float(m.group(0)))
62 print(
"Program exited early. Regular expression search for error failed.")
67 for key, operator in enumerate(target_operators):
68 print(
"\n\n%s rates: porder:%s\n============="%(operator.replace(
'\\',
''),
porder))
69 for i in range(1,len(errors[key])):
70 if (errors[key][i]!=0):
71 rate = math.log(errors[key][i]/errors[key][i-1])/math.log(.5)
72 print(
str(rate) +
", " +
str(errors[key][i]) +
", " +
str(errors[key][i-1]))
73 assert(check_bounds(
porder, rate))
75 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)
staggered TIMEOUT REQUIRED_FILES< TARGET_FILE:GMLS_Staggered_Manifold_Test > exit(1)