diff --git a/generate/generate.py b/generate/generate.py index 613c31559283b6c165e4e1204f1e50df5a9059b8..3a90089fc97dd0b1526e1881352c18e17a13c382 100644 --- a/generate/generate.py +++ b/generate/generate.py @@ -71,13 +71,16 @@ def unfold_toml_dict(toml_dict): ) operators_unfolded.append(operator_cleared) elif "components-trial" in operator or "components-test" in operator: - comp_str = "components-trial" if "components-trial" in operator else "components-test" + comp_str = ( + "components-trial" + if "components-trial" in operator + else "components-test" + ) for comp in operator[comp_str]: operator_cleared = operator.copy() operator_cleared.pop(comp_str) - operator_cleared.update({comp_str.replace('s-', '_'): comp}) + operator_cleared.update({comp_str.replace("s-", "_"): comp}) operators_unfolded.append(operator_cleared) - print(operators_unfolded) else: operators_unfolded.append(operator) toml_dict_unfolded[form_str] = operators_unfolded @@ -313,7 +316,9 @@ def generate_operator( trial_space = fe_spaces[spec["trial-space"]] test_space = fe_spaces[spec["test-space"]] - name = elementwise_operator_name(form_str, spec) # Will use operator-name from spec if provided + name = elementwise_operator_name( + form_str, spec + ) # Will use operator-name from spec if provided optimizations = { operator_generation.optimizer.opts_arg_mapping[opt.upper()] for opt in spec["optimizations"] @@ -350,12 +355,24 @@ def generate_operator( == spec["form-args"]["component_trial"] ) - if "component_test" in spec and "component_trial" not in spec: + if "form-args" in spec: + if ( + "component_test" in spec["form-args"] + and "component_trial" in spec["form-args"] + ): + test_space = function_space.TensorialVectorFunctionSpace( + test_space, single_component=spec["form-args"]["component_test"] + ) + trial_space = function_space.TensorialVectorFunctionSpace( + trial_space, single_component=spec["form-args"]["component_trial"] + ) + + elif "component_test" in spec: test_space = function_space.TensorialVectorFunctionSpace( test_space, single_component=spec["component_test"] ) - if "component_trial" in spec and "component_test" not in spec: + elif "component_trial" in spec: trial_space = function_space.TensorialVectorFunctionSpace( trial_space, single_component=spec["component_trial"] ) @@ -415,7 +432,10 @@ def generate_operator( optimizations=optimizations, ) - dir_path = os.path.join(args.output, spec["folder-name"] if "folder-name" in spec.keys() else form_str) + dir_path = os.path.join( + args.output, + spec["folder-name"] if "folder-name" in spec.keys() else form_str, + ) operator.generate_class_code( dir_path, class_files=operator_generation.operators.CppClassFiles.HEADER_IMPL_AND_VARIANTS, @@ -437,7 +457,11 @@ def generate_operator( def elementwise_operator_name(form_str: str, spec: Dict[str, Any]) -> str: - operator_name = spec["operator-name"] if "operator-name" in spec else form_str.title().replace("_", "") + operator_name = ( + spec["operator-name"] + if "operator-name" in spec + else form_str.title().replace("_", "") + ) if spec["trial-space"] == spec["test-space"]: space_mapping = spec["trial-space"] @@ -455,10 +479,10 @@ def elementwise_operator_name(form_str: str, spec: Dict[str, Any]) -> str: # I do not like this, but should do the trick until we have actual vector function spaces in the HOG. if "component_test" in spec and "component_trial" not in spec: component = f"_{spec['component_test']}_0" - + if "component_trial" in spec and "component_test" not in spec: component = f"_0_{spec['component_trial']}" - + blending = "" if spec.get("blending", "IdentityMap") != "IdentityMap": blending = spec["blending"] diff --git a/operators.toml b/operators.toml index 064d423ec724e5be1bd6a56364c93d38373a3e3e..a956d4ef512b0e3570706af403550e6bbd224a0b 100644 --- a/operators.toml +++ b/operators.toml @@ -200,15 +200,7 @@ optimizations = ["moveconstants", "vectorize", "quadloops", "tabulate"] blending = "IcosahedralShellMap" [[divergence]] -trial-space = "P2Vector" -test-space = "P1" -dimensions = [2, 3] -quadrature = 2 -loop-strategy = "cubes" -optimizations = ["moveconstants", "vectorize"] - -[[divergence]] -trial-space = "P2Vector" +trial-space = "P2" test-space = "P1" components-trial = [0, 1, 2] dimensions = [2, 3] @@ -227,7 +219,7 @@ optimizations = ["moveconstants", "vectorize"] blending = "AnnulusMap" [[divergence]] -trial-space = "P2Vector" +trial-space = "P2" test-space = "P1" components-trial = [0, 1, 2] dimensions = [3] @@ -317,6 +309,41 @@ loop-strategy = "sawtooth" optimizations = ["moveconstants", "vectorize"] blending = "IcosahedralShellMap" +[[epsilon]] +trial-space = "P2" +test-space = "P2" +components-trial = [0, 1, 2] +components-test = [0, 1, 2] +form-space-args.coefficient_function_space = "P2" +dimensions = [2, 3] +quadrature = 2 +loop-strategy = "sawtooth" +optimizations = ["moveconstants", "vectorize", "quadloops", "tabulate"] + +[[epsilon]] +trial-space = "P2" +test-space = "P2" +components-trial = [0, 1] +components-test = [0, 1] +form-space-args.coefficient_function_space = "P2" +dimensions = [2] +quadrature = 3 +loop-strategy = "sawtooth" +optimizations = ["moveconstants", "vectorize", "quadloops", "tabulate"] +blending = "AnnulusMap" + +[[epsilon]] +trial-space = "P2" +test-space = "P2" +components-trial = [0, 1, 2] +components-test = [0, 1, 2] +form-space-args.coefficient_function_space = "P2" +dimensions = [3] +quadrature = 3 +loop-strategy = "sawtooth" +optimizations = ["moveconstants", "vectorize", "quadloops", "tabulate"] +blending = "IcosahedralShellMap" + [[epsilon]] trial-space = "P2Vector" test-space = "P2Vector" @@ -346,6 +373,41 @@ loop-strategy = "sawtooth" optimizations = ["moveconstants", "vectorize", "quadloops", "tabulate"] blending = "IcosahedralShellMap" +[[full_stokes]] +trial-space = "P2" +test-space = "P2" +components-trial = [0, 1, 2] +components-test = [0, 1, 2] +form-space-args.coefficient_function_space = "P2" +dimensions = [2, 3] +quadrature = 2 +loop-strategy = "sawtooth" +optimizations = ["moveconstants", "vectorize", "quadloops", "tabulate"] + +[[full_stokes]] +trial-space = "P2" +test-space = "P2" +components-trial = [0, 1] +components-test = [0, 1] +form-space-args.coefficient_function_space = "P2" +dimensions = [2] +quadrature = 3 +loop-strategy = "sawtooth" +optimizations = ["moveconstants", "vectorize", "quadloops", "tabulate"] +blending = "AnnulusMap" + +[[full_stokes]] +trial-space = "P2" +test-space = "P2" +components-trial = [0, 1, 2] +components-test = [0, 1, 2] +form-space-args.coefficient_function_space = "P2" +dimensions = [3] +quadrature = 3 +loop-strategy = "sawtooth" +optimizations = ["moveconstants", "vectorize", "quadloops", "tabulate"] +blending = "IcosahedralShellMap" + [[full_stokes]] trial-space = "P2Vector" test-space = "P2Vector"