v0.10.0
Functions | Variables
optimal_mass_transport.cpp File Reference

optimal mass transport More...

#include <BasicFiniteElements.hpp>
#include <OptimalMassTransport.hpp>

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Variables

static char help [] = "...\n\n"
 

Detailed Description

optimal mass transport

Definition in file optimal_mass_transport.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 28 of file optimal_mass_transport.cpp.

28  {
29 
30 
31 
32 
33  PetscInitialize(&argc,&argv,(char *)0,help);
34 
35  moab::Core mb_instance;
36  moab::Interface& moab = mb_instance;
37 
38  ParallelComm* pcomm = ParallelComm::get_pcomm(&moab,MYPCOMM_INDEX);
39  if(pcomm == NULL) pcomm = new ParallelComm(&moab,PETSC_COMM_WORLD);
40 
41  //Read parameters from line command
42  PetscBool flg_file;
43  char mesh_file_name[255];
44  PetscInt order = 2;
45  PetscBool is_partitioned = PETSC_FALSE;
46 
47  ierr = PetscOptionsBegin(
48  PETSC_COMM_WORLD,"","Shell prism configure","none"
49  ); CHKERRQ(ierr);
50  ierr = PetscOptionsString(
51  "-my_file",
52  "mesh file name","", "mesh.h5m",mesh_file_name, 255, &flg_file
53  ); CHKERRQ(ierr);
54  ierr = PetscOptionsInt(
55  "-my_order",
56  "default approximation order",
57  "",order,&order,PETSC_NULL
58  ); CHKERRQ(ierr);
59  ierr = PetscOptionsBool(
60  "-my_is_partitioned",
61  "set if mesh is partitioned (this result that each process keeps only part of the mesh)",
62  "",PETSC_FALSE,&is_partitioned,PETSC_NULL
63  ); CHKERRQ(ierr);
64  ierr = PetscOptionsEnd(); CHKERRQ(ierr);
65 
66  if(is_partitioned == PETSC_TRUE) {
67  //Read mesh to MOAB
68  const char *option;
69  option = "PARALLEL=READ_PART;"
70  "PARALLEL_RESOLVE_SHARED_ENTS;"
71  "PARTITION=PARALLEL_PARTITION;";
72  rval = moab.load_file(mesh_file_name, 0, option); CHKERRQ_MOAB(rval);
73  } else {
74  const char *option;
75  option = "";
76  rval = moab.load_file(mesh_file_name, 0, option); CHKERRQ_MOAB(rval);
77  }
78 
79  //Create mofem interface
80  MoFEM::Core core(moab);
81  MoFEM::Interface& m_field = core;
82 
83  OptimalMassTransport opt(m_field);
84  opt.blockData.oRder = order;
85  ierr = opt.printGMeshMeshsets(); CHKERRQ(ierr);
86  // ierr = opt.getNaturalBc(); CHKERRQ(ierr);
87  // ierr = opt.getEssentialBc(); CHKERRQ(ierr);
88  // ierr = opt.createFields(); CHKERRQ(ierr);
89  // ierr = opt.createElements(); CHKERRQ(ierr);
90  // ierr = opt.createProblem(); CHKERRQ(ierr);
91  // ierr = opt.solveProblem(); CHKERRQ(ierr);
92  // ierr = opt.postProcessResults(); CHKERRQ(ierr);
93  // ierr = opt.destroyProblem(); CHKERRQ(ierr);
94 
95  ierr = PetscFinalize(); CHKERRQ(ierr);
96 
97  return 0;
98 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:523
Deprecated interface functions.
CoreTmp< 0 > Core
Definition: Core.hpp:1129
char mesh_file_name[255]
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:85
static char help[]
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:87
constexpr int order
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:292
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1943
Core (interface) class.
Definition: Core.hpp:77

Variable Documentation

◆ help

char help[] = "...\n\n"
static

Definition at line 26 of file optimal_mass_transport.cpp.