NEMoSys  0.63.0
A modular, extensible resource with robust automated mesh generation, mesh quality analysis, adaptive mesh refinement, and data transfer between arbitrary meshes.
NEM::DRV::TransferDriver Class Reference

Detailed Description

Definition at line 40 of file TransferDriver.H.

Classes

struct  Files
 
struct  Opts
 

Public Member Functions

 TransferDriver (Files files, Opts opts)
 
const FilesgetFiles () const
 
void setFiles (Files files)
 
const OptsgetOpts () const
 
void setOpts (Opts opts)
 
void execute () const override
 Run the workflow represented by the driver. More...
 
 ~TransferDriver () override
 

Static Public Member Functions

static std::shared_ptr< TransferBaseCreateTransferObject (meshBase *srcmsh, meshBase *trgmsh, const std::string &method)
 
static std::unique_ptr< NemDriverreadJSON (const jsoncons::json &inputjson)
 Factory method for all drivers. More...
 

Private Member Functions

 TransferDriver ()
 
jsoncons::string_view getProgramType () const override
 

Private Attributes

Files files_
 
Opts opts_
 

Static Private Attributes

static constexpr const char * programType = "Transfer"
 

Inherits NEM::DRV::NemDriver.

Constructor & Destructor Documentation

◆ TransferDriver() [1/2]

NEM::DRV::TransferDriver::TransferDriver ( Files  files,
Opts  opts 
)

Definition at line 56 of file TransferDriver.C.

57  : files_(std::move(files)), opts_(std::move(opts)) {
58  std::cout << "TransferDriver created" << std::endl;
59 }

◆ ~TransferDriver()

NEM::DRV::TransferDriver::~TransferDriver ( )
override

Definition at line 99 of file TransferDriver.C.

99  {
100  std::cout << "TransferDriver destroyed" << std::endl;
101 }

◆ TransferDriver() [2/2]

NEM::DRV::TransferDriver::TransferDriver ( )
private

Definition at line 61 of file TransferDriver.C.

61 : TransferDriver({{}, {}, {}}, {{}, {}}) {}

Member Function Documentation

◆ CreateTransferObject()

std::shared_ptr< TransferBase > NEM::DRV::TransferDriver::CreateTransferObject ( meshBase srcmsh,
meshBase trgmsh,
const std::string &  method 
)
static

Definition at line 107 of file TransferDriver.C.

References FETransfer::CreateShared(), ConservativeSurfaceTransfer::CreateShared(), and ConservativeVolumeTransfer::CreateShared().

Referenced by OrderOfAccuracy::computeMeshWithResolution(), OrderOfAccuracy::computeRichardsonExtrapolation(), execute(), OrderOfAccuracy::OrderOfAccuracy(), proteusHdf5::proteusHdf5(), NEM::ADP::Refine::run(), and vtkMesh::vtkMesh().

108  {
109  if (method == "Consistent Interpolation") {
110  return FETransfer::CreateShared(srcmsh, trgmsh);
111  }
112 #ifdef HAVE_IMPACT
113  else if (method == "Conservative Surface Transfer") {
114  return ConservativeSurfaceTransfer::CreateShared(srcmsh, trgmsh);
115  }
116 #endif
117 #ifdef HAVE_SUPERMESH
118  else if (method == "Conservative Volume Transfer") {
119  return ConservativeVolumeTransfer::CreateShared(srcmsh, trgmsh);
120  }
121 #endif
122  else {
123  std::cerr << "Method " << method << " is not supported." << std::endl;
124  std::cerr << "Supported methods are : " << std::endl;
125  std::cerr << "1) Consistent Interpolation" << std::endl;
126 #ifdef HAVE_IMPACT
127  std::cerr << "2) Conservative Surface Transfer" << std::endl;
128 #endif
129 #ifdef HAVE_SUPERMESH
130  std::cerr << "3) Conservative Volume Transfer" << std::endl;
131 #endif
132  exit(1);
133  }
134 }
static std::shared_ptr< ConservativeVolumeTransfer > CreateShared(meshBase *_source, meshBase *_target)
static std::shared_ptr< ConservativeSurfaceTransfer > CreateShared(meshBase *_source, meshBase *_target)
static std::shared_ptr< FETransfer > CreateShared(meshBase *source, meshBase *target)
Definition: FETransfer.H:49

◆ execute()

void NEM::DRV::TransferDriver::execute ( ) const
overridevirtual

Implements NEM::DRV::NemDriver.

Definition at line 63 of file TransferDriver.C.

References NEM::DRV::TransferDriver::Opts::arrayNames, NEM::DRV::TransferDriver::Opts::checkQuality, meshBase::Create(), CreateTransferObject(), nemAux::Timer::elapsed(), files_, NEM::DRV::TransferDriver::Opts::method, opts_, NEM::DRV::TransferDriver::Files::outputMeshFile, NEM::DRV::TransferDriver::Files::sourceMeshFile, nemAux::Timer::start(), nemAux::Timer::stop(), and NEM::DRV::TransferDriver::Files::targetMeshFile.

63  {
64  std::shared_ptr<meshBase> source{
66  std::shared_ptr<meshBase> target{
68  std::cout << "TransferDriver created" << std::endl;
69 
70  nemAux::Timer T;
71  T.start();
72  source->setCheckQuality(this->opts_.checkQuality);
73  // source->transfer(target, method, arrayNames);
75  source.get(), target.get(), this->opts_.method);
76  if (this->opts_.arrayNames) {
77  transfer->transferPointData(
78  source->getArrayIDs(this->opts_.arrayNames.value()),
79  source->getNewArrayNames());
80  } else {
81  transfer->run(source->getNewArrayNames());
82  }
83  source->write("new.vtu");
84  T.stop();
85 
86  std::cout << "Time spent transferring data (ms) " << T.elapsed() << std::endl;
87 
88  target->write(this->files_.outputMeshFile);
89 }
static meshBase * Create(const std::string &fname)
Construct vtkMesh from filename.
Definition: meshBase.C:78
jsoncons::optional< std::vector< std::string > > arrayNames
static std::shared_ptr< TransferBase > CreateTransferObject(meshBase *srcmsh, meshBase *trgmsh, const std::string &method)

◆ getFiles()

const TransferDriver::Files & NEM::DRV::TransferDriver::getFiles ( ) const

Definition at line 91 of file TransferDriver.C.

References files_.

91 { return files_; }

◆ getOpts()

const TransferDriver::Opts & NEM::DRV::TransferDriver::getOpts ( ) const

Definition at line 95 of file TransferDriver.C.

References opts_.

95 { return opts_; }

◆ getProgramType()

jsoncons::string_view NEM::DRV::TransferDriver::getProgramType ( ) const
overrideprivatevirtual

Implements NEM::DRV::NemDriver.

Definition at line 103 of file TransferDriver.C.

References programType.

103  {
104  return programType;
105 }
static constexpr const char * programType

◆ readJSON()

std::unique_ptr< NemDriver > NEM::DRV::NemDriver::readJSON ( const jsoncons::json &  inputjson)
staticinherited
Parameters
inputjsonjson input with "Program Type" key
Returns
pointer to base NemDriver class

Definition at line 37 of file NemDriver.C.

Referenced by NEM::DRV::MeshGenDriver::MeshGenDriver().

37  {
38  return inputjson.as<std::unique_ptr<NemDriver>>();
39 }

◆ setFiles()

void NEM::DRV::TransferDriver::setFiles ( Files  files)

Definition at line 93 of file TransferDriver.C.

References files_.

93 { this->files_ = std::move(files); }

◆ setOpts()

void NEM::DRV::TransferDriver::setOpts ( Opts  opts)

Definition at line 97 of file TransferDriver.C.

References opts_.

97 { this->opts_ = std::move(opts); }

Member Data Documentation

◆ files_

Files NEM::DRV::TransferDriver::files_
private

Definition at line 85 of file TransferDriver.H.

Referenced by execute(), getFiles(), and setFiles().

◆ opts_

Opts NEM::DRV::TransferDriver::opts_
private

Definition at line 86 of file TransferDriver.H.

Referenced by execute(), getOpts(), and setOpts().

◆ programType

constexpr const char* NEM::DRV::TransferDriver::programType = "Transfer"
staticprivate

Definition at line 82 of file TransferDriver.H.

Referenced by getProgramType().


The documentation for this class was generated from the following files: