mpi/distribution/eigenproblem/harmonic.cc File Reference
#include "generic.h"
#include "meshes/one_d_mesh.h"

Classes

class  ComplexLess< T >
 
class  HarmonicEquations
 
class  QHarmonicElement< NNODE_1D >
 
class  HarmonicProblem< ELEMENT, EIGEN_SOLVER >
 1D Harmonic problem in unit interval. More...
 

Functions

int main (int argc, char **argv)
 Driver for 1D Poisson problem. More...
 

Function Documentation

◆ main()

int main ( int argc  ,
char **  argv 
)

Driver for 1D Poisson problem.

///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////

546 {
547 #ifdef OOMPH_HAS_MPI
548  MPI_Helpers::init(argc,argv);
549 #endif
550  // Set up the problem:
551  unsigned n_element=100; //Number of elements
552 
553 #ifdef OOMPH_HAS_TRILINOS
554 //Solve with Anasazi (non distributed)
555  clock_t t_start1 = clock();
556  {
558 
559  problem.solve(1);
560  }
561  clock_t t_end1 = clock();
562 
563 
564  //Solve with Anasazi (distributed)
565  clock_t t_start2 = clock();
566  {
567 
569  //In the validation case there should be two processors
570  if(problem.communicator_pt()->nproc()==2)
571  {
572  //Setup a dummy partition
573  unsigned n_element = problem.mesh_pt()->nelement();
574  Vector<unsigned> element_partition(n_element);
575  for(unsigned e=0;e<n_element/2;e++) {element_partition[e]=0;}
576  for(unsigned e=n_element/2;e<n_element;e++) {element_partition[e]=1;}
577  problem.distribute(element_partition);
578  }
579  else
580  {
581  problem.distribute();
582  }
583  problem.solve(2);
584  }
585  clock_t t_end2 = clock();
586 
587  oomph_info << "ANASAZI TIME (non-distributed): "
588  << (double)(t_end1 - t_start1)/CLOCKS_PER_SEC
589  << std::endl;
590 
591 
592  oomph_info << "ANASAZI TIME (distributed): " <<
593  (double)(t_end2 - t_start2)/CLOCKS_PER_SEC
594  << std::endl;
595 #endif
596 
597 #ifdef OOMPH_HAS_MPI
598  MPI_Helpers::finalize();
599 #endif
600 
601 } // end of main
Array< double, 1, 3 > e(1./3., 0.5, 2.)
1D Harmonic problem in unit interval.
Definition: eigenproblems/harmonic/harmonic.cc:269
Class for the Anasazi eigensolver.
Definition: trilinos_eigen_solver.h:571
OomphInfo oomph_info
Definition: oomph_definitions.cc:319
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References e(), oomph::oomph_info, and problem.