ROL
Namespaces | Functions
json/example_01.hpp File Reference

Example of how to supply ROL with parameters from a JSON file. Requires that json-cpp be installed. More...

#include "json/json.h"
#include "Teuchos_ParameterList.hpp"
#include <fstream>
#include <string>

Go to the source code of this file.

Namespaces

namespace  ROL
 

Functions

void ROL::addJSONBlockToPL (const Json::Value &block, ROL::ParameterList &parlist)
 Iterate over a block and insert key-value pairs into the ROL::ParameterList.
 
void ROL::addJSONPairToPL (const Json::Value &block, const std::string &key, ROL::ParameterList &parlist)
 Given a JSON block and a key, get the value and insert the key-value pair into a ROL::ParameterList. If the value is itself a block, recursively iterate.
 
void ROL::JSON_Parameters (const std::string &jsonFileName, ROL::ParameterList &parlist)
 Read a JSON file and store all parameters in a ROL::ParameterList. Checks for a key called "Algorithm" which has a string value which can specify a Step Type (Linesearch or Trust-Region) and either a Descent Type or a Trust-Region Subproblem Solver Type.
 
template<class Real >
void ROL::stepFactory (ROL::ParameterList &parlist, ROL::Ptr< ROL::Step< Real > > &step)
 A minimalist step factory which specializes the Step Type depending on whether a Trust-Region or Linesearch has been selected.

 

Detailed Description

Example of how to supply ROL with parameters from a JSON file. Requires that json-cpp be installed.

To build this example, add the following to the cmake call in your trilinos build script -D TPL_ENABLE_JSONCPP=ON \ -D JSONCPP_INCLUDE_DIRS:PATH=/usr/include/jsoncpp \ -D JSONCPP_LIBRARY_DIRS=/usr/lib/x86_64-linux-gnu \ -D JSONCPP_LIBRARY_NAMES:STRING="jsoncpp" \

These example paths above are default for Ubuntu 64 bit if jsoncpp is installed using sudo apt-get install libjsoncpp-dev

Possible build failures: Unable to find json.h - JSONCPP_INCLUDE_DIRS variable is incorrect Undefined reference to json::value - JSONCPP_LIBRARY variables are incorrect

Author
Created by Greg von Winckel

Definition in file json/example_01.hpp.