MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / RealCompile

Method RealCompile

fem/coefficient.cpp:6878–7044  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6876 }
6877
6878 void RealCompile(int maxderiv, bool wait, bool keep_files)
6879 {
6880 _real_compile = true;
6881 _maxderiv = maxderiv;
6882 _wait = wait;
6883 _keep_files = keep_files;
6884
6885 std::vector<string> link_flags;
6886 if(cf->IsComplex())
6887 maxderiv = 0;
6888 stringstream s;
6889 string pointer_code;
6890 string top_code = ""
6891 "#include<coefficient.hpp>\n"
6892 "#include<symbolicintegrator.hpp>\n"
6893 "#if defined(__GNUC__) || defined(__clang__)\n"
6894 "#pragma GCC diagnostic ignored \"-Wunused-but-set-variable\"\n"
6895 "#pragma GCC diagnostic ignored \"-Wunused-variable\"\n"
6896 "#endif\n"
6897 "using namespace ngfem;\n"
6898 "extern \"C\" {\n"
6899 ;
6900
6901 string parameters[3] = {"results", "deriv", "dderiv"};
6902
6903 for (int deriv : Range(maxderiv+1))
6904 for (auto simd : {false,true}) {
6905 if (!simd && deriv == 0)
6906 cout << IM(3) << "Compiled CF:" << endl;
6907
6908 Code code = GenerateProgram(deriv, simd);
6909
6910 /*
6911 Code code;
6912 code.is_simd = simd;
6913 code.deriv = deriv;
6914
6915 string res_type = cf->IsComplex() ? "Complex" : "double";
6916 if(simd) res_type = "SIMD<" + res_type + ">";
6917 if(deriv==1) res_type = "AutoDiff<1," + res_type + ">";
6918 if(deriv==2) res_type = "AutoDiffDiff<1," + res_type + ">";
6919 code.res_type = res_type;
6920 */
6921
6922 string res_type = code.res_type;
6923
6924 /*
6925 for (auto i : Range(steps)) {
6926 auto& step = *steps[i];
6927 if (!simd && deriv == 0)
6928 cout << IM(3) << "step " << i << ": " << typeid(step).name() << endl;
6929 code.body += string("// step ")+ToString(i)+": "+step.GetDescription()+"\n";
6930 step.GenerateCode(code, inputs[i],i);
6931 }
6932 */
6933
6934 pointer_code += code.pointer;
6935 top_code += code.top;

Callers 1

CompileFunction · 0.80

Calls 14

IMClass · 0.85
VarFunction · 0.85
ToLiteralFunction · 0.85
CompileCodeFunction · 0.85
DeclareMethod · 0.80
DimensionsMethod · 0.80
findMethod · 0.80
beginFunction · 0.70
endFunction · 0.70
RangeFunction · 0.50
IsComplexMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected