Ejemplo n.º 1
0
/**
@todo JSON access errors lack specifier
@todo Check that omegas ar filled/exits
@todo Clean up nested checks for optional JSON arguments
@todo Eigenvalues should be computed independent of json output,
stored and used twice, for screen and file
*/
void run(const Settings &s) {
  // empty configurators
  unique_ptr<csmp::tperm::Configurator> mconf =
      make_unique<csmp::tperm::NullConfigurator>();
  unique_ptr<csmp::tperm::Configurator> fconf =
      make_unique<csmp::tperm::NullConfigurator>();
  // get matrix configurator
  Settings cs(s, "configuration");
  if (cs.json.count("matrix")) {
    Settings mcs(cs, "matrix");
    mconf = MatrixConfiguratorFactory().configurator(mcs);
  }
  // get fracture configurator
  if (cs.json.count("fractures")) {
    Settings fcs(cs, "fractures");
    fconf = FractureConfiguratorFactory().configurator(fcs);
  }
  // get omega generator
  Settings acs(s, "analysis");
  auto ogen = make_omega_generator(acs);
  // load model...
  Settings ms(s, "model");
  auto model = load_model(ms);
  // configure material properties
  mconf->configure(*model);
  fconf->configure(*model);
  // sort boundaries
  auto bds = sort_boundaries(*model, s);
  // ready to solve
  solve(bds, *model);
  // generate omegas
  auto omegas = ogen->generate(*model);
  auto nomegas = named_omegas(omegas);
  // get upscaled tensors
  auto omega_tensors = fetch(*model, nomegas);
  // results
  string jres_fname = "";
  if (s.json.count("output")) {
    Settings outs(s, "output");
    if (outs.json.count("save final binary")) // write to csmp binary
      if (outs.json["save final binary"].get<string>() != "")
        save_model(*model,
                   outs.json["save final binary"].get<string>().c_str());
    if (outs.json.count("vtu")) { // write to vtu
      if (outs.json["vtu"].get<bool>()) {
        make_omega_regions(nomegas, *model);
        vtu(omega_tensors, *model);
      }
      if (outs.json.count("vtu regions"))
        vtu(outs.json["vtu regions"].get<vector<string>>(), *model);
    }
    if (outs.json.count("results file name")) // write to json
      jres_fname = s.json["output"]["results file name"].get<string>();
  }
  report(omega_tensors, *model, jres_fname.c_str());
}
Ejemplo n.º 2
0
int main (int argc, char* argv[])
{
    ApplicationsLib::LogogSetup logog_setup;

    TCLAP::CmdLine cmd(
        "Converts OGS mesh into VTK mesh.\n\n"
        "OpenGeoSys-6 software, version " +
            BaseLib::BuildInfo::ogs_version +
            ".\n"
            "Copyright (c) 2012-2019, OpenGeoSys Community "
            "(http://www.opengeosys.org)",
        ' ', BaseLib::BuildInfo::ogs_version);
    TCLAP::ValueArg<std::string> mesh_in("i", "mesh-input-file",
                                         "the name of the file containing the input mesh", true,
                                         "", "file name of input mesh");
    cmd.add(mesh_in);
    TCLAP::ValueArg<std::string> mesh_out("o", "mesh-output-file",
                                          "the name of the file the mesh will be written to", true,
                                          "", "file name of output mesh");
    cmd.add(mesh_out);
    cmd.parse(argc, argv);

    std::unique_ptr<MeshLib::Mesh const> mesh(
        MeshLib::IO::readMeshFromFile(mesh_in.getValue()));
    INFO("Mesh read: %d nodes, %d elements.", mesh->getNumberOfNodes(), mesh->getNumberOfElements());

    MeshLib::IO::VtuInterface vtu(mesh.get());
    vtu.writeToFile(mesh_out.getValue());

    return EXIT_SUCCESS;
}
Ejemplo n.º 3
0
int main (int argc, char* argv[])
{
	LOGOG_INITIALIZE();
	logog::Cout* logog_cout (new logog::Cout);
	BaseLib::LogogSimpleFormatter *custom_format (new BaseLib::LogogSimpleFormatter);
	logog_cout->SetFormatter(*custom_format);

	TCLAP::CmdLine cmd("Converts OGS mesh into VTK mesh.", ' ', "0.1");
	TCLAP::ValueArg<std::string> mesh_in("i", "mesh-input-file",
	                                     "the name of the file containing the input mesh", true,
	                                     "", "file name of input mesh");
	cmd.add(mesh_in);
	TCLAP::ValueArg<std::string> mesh_out("o", "mesh-output-file",
	                                      "the name of the file the mesh will be written to", true,
	                                      "", "file name of output mesh");
	cmd.add(mesh_out);
	cmd.parse(argc, argv);

	MeshLib::Mesh* mesh (FileIO::readMeshFromFile(mesh_in.getValue()));
	INFO("Mesh read: %d nodes, %d elements.", mesh->getNNodes(), mesh->getNElements());

	FileIO::VtuInterface vtu(mesh);
	vtu.writeToFile(mesh_out.getValue());

	delete custom_format;
	delete logog_cout;
	LOGOG_SHUTDOWN();

	return 0;
}
Ejemplo n.º 4
0
int main (int argc, char* argv[])
{
    ApplicationsLib::LogogSetup logog_setup;

    TCLAP::CmdLine cmd("Converts OGS mesh into VTK mesh.", ' ', "0.1");
    TCLAP::ValueArg<std::string> mesh_in("i", "mesh-input-file",
                                         "the name of the file containing the input mesh", true,
                                         "", "file name of input mesh");
    cmd.add(mesh_in);
    TCLAP::ValueArg<std::string> mesh_out("o", "mesh-output-file",
                                          "the name of the file the mesh will be written to", true,
                                          "", "file name of output mesh");
    cmd.add(mesh_out);
    cmd.parse(argc, argv);

    std::unique_ptr<MeshLib::Mesh const> mesh(
        MeshLib::IO::readMeshFromFile(mesh_in.getValue()));
    INFO("Mesh read: %d nodes, %d elements.", mesh->getNNodes(), mesh->getNElements());

    MeshLib::IO::VtuInterface vtu(mesh.get());
    vtu.writeToFile(mesh_out.getValue());

    return EXIT_SUCCESS;
}