code: public void write(Engine engine, Writer writer, List<Double> inputValues,
              List<InputVariable> activeVariables) throws IOException {
          if (inputValues.isEmpty()) {
              writer.append("\n");
              return;
          }
  
          if (inputValues.size() < engine.numberOfInputVariables()) {
              throw new RuntimeException(String.format(
                      "[export error] engine has <%d> input variables, "
                      + "but input data provides <%d> values",
                      engine.numberOfInputVariables(), inputValues.size()));
          }
  
          if (activeVariables.size() != engine.getInputVariables().size()) {
              throw new RuntimeException(String.format(
                      "[exporter error] number of active variables <%d> "
                      + "must match the number of input variables in the engine <%d>",
                      activeVariables.size(), engine.getInputVariables().size()));
          }
  
          List<Double> values = new ArrayList<Double>();
          for (int i = 0; i < engine.numberOfInputVariables(); ++i) {
              InputVariable inputVariable = engine.getInputVariable(i);
              double inputValue;
              if (inputVariable == activeVariables.get(i)) {
                  inputValue = inputValues.get(i);
              } else {
                  inputValue = inputVariable.getValue();
              }
              inputVariable.setValue(inputValue);
              if (exportInputValues) {
                  values.add(inputValue);
              }
          }
  
          engine.process();
  
          for (int i = 0; i < engine.numberOfOutputVariables(); ++i) {
              OutputVariable outputVariable = engine.getOutputVariable(i);
              if (exportOutputValues) {
                  values.add(outputVariable.getValue());
              }
          }
          writer.append(Op.join(values, separator)).append("\n");
      }
docs: Writes the engine into the given writer
  
  @param engine is the engine to export
  @param writer is the output where the engine will be written to
  @param inputValues is the vector of input values
  @param activeVariables contains the input variables to generate values for.
  The input variables must be in the same order as in the engine. A value of
  fl::null indicates the variable is not active.
  @throws IOException if any error occurs upon writing to the writer