Skip to content
Snippets Groups Projects
Commit 1059351c authored by Oliver Sander's avatar Oliver Sander Committed by sander
Browse files

Split the Python function giving the initial iterate into a separate file

Some of these Python functions are so long that you cannot reasonably keep
them in a single string in a ParameterTree entry.  To be more flexible here
the initial iterate function is now expected in a separate file.

[[Imported from SVN: r10066]]
parent fa0be7e9
No related branches found
No related tags found
No related merge requests found
...@@ -145,11 +145,14 @@ int main (int argc, char *argv[]) try ...@@ -145,11 +145,14 @@ int main (int argc, char *argv[]) try
// Initial iterate // Initial iterate
// ////////////////////////// // //////////////////////////
std::string lambda = std::string("lambda x: (") + parameterSet.get<std::string>("initialIterate") + std::string(")"); // Read initial iterate into a PythonFunction
PythonFunction<FieldVector<double,dim>, TargetSpace::CoordinateType > pythonInitialIterate(Python::evaluate(lambda)); typedef VirtualDifferentiableFunction<FieldVector<double, dim>, TargetSpace::CoordinateType> FBase;
Python::Module module = Python::import(parameterSet.get<std::string>("initialIterate"));
auto pythonInitialIterate = module.get("fdf").toC<std::shared_ptr<FBase>>();
std::vector<TargetSpace::CoordinateType> v; std::vector<TargetSpace::CoordinateType> v;
Functions::interpolate(feBasis, v, pythonInitialIterate); Functions::interpolate(feBasis, v, *pythonInitialIterate);
for (size_t i=0; i<x.size(); i++) for (size_t i=0; i<x.size(); i++)
x[i] = v[i]; x[i] = v[i];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment