G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsXBraid.h
Go to the documentation of this file.
1 
14 #pragma once
15 
16 #include <gismo.h>
17 
18 #ifndef GISMO_WITH_MPI
19 #define braid_SEQUENTIAL 1
20 #endif
21 
22 #include <XBraid/braid/braid.hpp>
23 
24 namespace gismo {
25 
27  class gsXBraidSyncStatus;
28  class gsXBraidStepStatus;
32 
72  template<typename T>
73  class gsXBraid : public BraidApp
74  {
75  public:
77  gsXBraid(const gsMpiComm& comm,
78  const braid_Real tstart,
79  const braid_Real tstop,
80  braid_Int ntime);
81 
83  virtual ~gsXBraid();
84 
86  virtual braid_Int Free(braid_Vector) { return braid_Int(0); }
87 
89  virtual braid_Int Residual(braid_Vector, braid_Vector, BraidStepStatus&)
91 
93  void solve() { core.Drive(); }
94 
95  public:
97  void SetMaxLevels(braid_Int max_levels) { core.SetMaxLevels(max_levels); }
98 
100  void SetIncrMaxLevels() { core.SetIncrMaxLevels(); }
101 
103  void SetSkip(braid_Int skip) { core.SetSkip(skip); }
104 
109  void SetMinCoarse(braid_Int min_coarse) { core.SetMinCoarse(min_coarse); }
110 
114  void SetNRelax(braid_Int level, braid_Int nrelax) { core.SetNRelax(level, nrelax); }
115 
118  void SetNRelax(braid_Int nrelax) { core.SetNRelax(-1, nrelax); }
119 
121  void SetAbsTol(braid_Real tol) { core.SetAbsTol(tol); }
122 
124  void SetRelTol(braid_Real tol) { core.SetRelTol(tol); }
125 
127  void SetTemporalNorm(braid_Int tnorm) { core.SetTemporalNorm(tnorm); }
128 
130  void SetCFactor(braid_Int level, braid_Int cfactor) { core.SetCFactor(level, cfactor); }
131 
133  void SetCFactor(braid_Int cfactor) { core.SetCFactor(-1, cfactor); }
134 
136  void SetPeriodic(braid_Int periodic) { core.SetPeriodic(periodic); }
137 
139  void SetMaxIter(braid_Int max_iter) { core.SetMaxIter(max_iter); }
140 
146  void SetPrintLevel(braid_Int print_level) { core.SetPrintLevel(print_level); }
147 
149  void SetPrintFile(const char *printfile_name) { core.SetPrintFile(printfile_name); }
150 
155  void SetSeqSoln(braid_Int use_seq_soln) { core.SetSeqSoln(use_seq_soln); }
156 
164  void SetAccessLevel(braid_Int access_level) { core.SetAccessLevel(access_level); }
165 
167  void SetFMG() { core.SetFMG(); }
168 
170  void SetNFMG(braid_Int k) { core.SetNFMG(k); }
171 
173  void SetNFMGVcyc(braid_Int nfmg_Vcyc) { core.SetNFMGVcyc(nfmg_Vcyc); }
174 
179  void SetStorage(braid_Int storage) { core.SetStorage(storage); }
180 
182  void SetRefine(braid_Int refine) {core.SetRefine(refine);}
183 
185  void SetMaxRefinements(braid_Int max_refinements) {core.SetMaxRefinements(max_refinements);}
186 
203  void SetRichardsonEstimation(braid_Int est_error, braid_Int richardson, braid_Int local_order)
204  { core.SetRichardsonEstimation(est_error, richardson, local_order); }
205 
206  public:
208  void SetResidual() { core.SetResidual(); }
209 
211  void SetSpatialCoarsenAndRefine() { core.SetSpatialCoarsenAndRefine(); }
212 
214  void SetSync() { core.SetSync(); }
215 
217  void SetDefaultPrintFile() { core.SetDefaultPrintFile(); }
218 
220  void SetFileIOLevel(braid_Int io_level) { core.SetFileIOLevel(io_level); }
221 
223  void SetCRelaxWt(braid_Int level, braid_Real Cwt) { core.SetCRelaxWt(level, Cwt); }
224 
226  void SetTPointsCutoff(braid_Int tpoints_cutoff) { core.SetTPointsCutoff(tpoints_cutoff); }
227 
229  void SetFullRNormRes(braid_PtFcnResidual residual) { core.SetFullRNormRes(residual); }
230 
232  void SetTimeGrid(braid_PtFcnTimeGrid tgrid) { core.SetTimeGrid(tgrid); }
233 
234  public:
236  void GetNumIter(braid_Int *niter_ptr) { core.GetNumIter(niter_ptr); }
237 
239  void GetRNorms(braid_Int *nrequest_ptr, braid_Real *rnorms) { core.GetRNorms(nrequest_ptr, rnorms); }
240 
242  void GetNLevels(braid_Int *nlevels_ptr) { core.GetNLevels(nlevels_ptr); }
243 
245  void GetMyID(braid_Int *myid_ptr) { core.GetMyID(myid_ptr); }
246 
248  braid_Int iterations() {
249  braid_Int niter;
250  GetNumIter(&niter);
251  return niter;
252  }
253 
255  braid_Real norm(braid_Int nrequest) {
256  braid_Real rnorm;
257  GetRNorms(&nrequest, &rnorm);
258  return rnorm;
259  }
260 
262  braid_Int levels() {
263  braid_Int nlevels;
264  GetNLevels(&nlevels);
265  return nlevels;
266  }
267 
269  braid_Int id() {
270  braid_Int myid;
271  GetMyID(&myid);
272  return myid;
273  }
274 
275  protected:
277  BraidCore core;
278  };
279 
280 
284  template<typename T>
285  class gsXBraid< gsMatrix<T> > : public gsXBraid<T>
286  {
287  public:
289  gsXBraid(const gsMpiComm& comm,
290  const braid_Real tstart,
291  const braid_Real tstop,
292  braid_Int ntime);
293 
295  virtual ~gsXBraid();
296 
298  virtual braid_Int Clone(braid_Vector u,
299  braid_Vector *v_ptr)
300  {
301  gsMatrix<T>* u_ptr = (gsMatrix<T>*) u;
302  gsMatrix<T>* v = new gsMatrix<T>();
303  *v = *u_ptr;
304  *v_ptr = (braid_Vector) v;
305  return braid_Int(0);
306  }
307 
309  virtual braid_Int Free(braid_Vector u)
310  {
311  gsMatrix<T>* u_ptr = (gsMatrix<T>*) u;
312  delete u_ptr;
313  return braid_Int(0);
314  }
315 
317  virtual braid_Int Sum(braid_Real alpha,
318  braid_Vector x,
319  braid_Real beta,
320  braid_Vector y)
321  {
322  gsMatrix<T>* x_ptr = (gsMatrix<T>*) x;
323  gsMatrix<T>* y_ptr = (gsMatrix<T>*) y;
324  *y_ptr = (T)alpha * (*x_ptr) + (T)beta * (*y_ptr);
325  return braid_Int(0);
326  }
327 
329  virtual braid_Int SpatialNorm(braid_Vector u,
330  braid_Real *norm_ptr)
331  {
332  gsMatrix<T> *u_ptr = (gsMatrix<T>*) u;
333  *norm_ptr = u_ptr->norm();
334  return braid_Int(0);
335  }
336 
338  virtual braid_Int BufPack(braid_Vector u,
339  void *buffer,
340  BraidBufferStatus &status)
341  {
342  gsMatrix<T> *u_ptr = (gsMatrix<T>*) u;
343  T* buffer_ptr = (T*) buffer;
344  T* data_ptr = u_ptr->data();
345  index_t size = u_ptr->rows()*u_ptr->cols();
346 
347  buffer_ptr[0] = u_ptr->rows();
348  buffer_ptr[1] = u_ptr->cols();
349  for (index_t idx = 0; idx < size; ++idx)
350  buffer_ptr[idx+2] = data_ptr[idx];
351 
352  status.SetSize(sizeof(T)*(size+2));
353  return braid_Int(0);
354  }
355 
357  virtual braid_Int BufUnpack(void *buffer,
358  braid_Vector *u_ptr,
359  BraidBufferStatus &status)
360  {
361  T* buffer_ptr = (T*) buffer;
362  index_t rows = buffer_ptr[0];
363  index_t cols = buffer_ptr[1];
364  gsMatrix<T>* u = new gsMatrix<T>(rows,cols);
365  T* data_ptr = u->data();
366 
367  for (index_t idx = 0; idx < rows*cols; ++idx)
368  data_ptr[idx] = buffer_ptr[idx+2];
369 
370  *u_ptr = (braid_Vector) u;
371  return braid_Int(0);
372  }
373  };
374 
378  template<typename T>
379  class gsXBraid< gsVector<T> > : public gsXBraid<T>
380  {
381  public:
383  gsXBraid(const gsMpiComm& comm,
384  const braid_Real tstart,
385  const braid_Real tstop,
386  braid_Int ntime);
387 
389  virtual ~gsXBraid();
390 
392  virtual braid_Int Clone(braid_Vector u,
393  braid_Vector *v_ptr)
394  {
395  gsVector<T>* u_ptr = (gsVector<T>*) u;
396  gsVector<T>* v = new gsVector<T>();
397  *v = *u_ptr;
398  *v_ptr = (braid_Vector) v;
399  return braid_Int(0);
400  }
401 
403  virtual braid_Int Free(braid_Vector u)
404  {
405  gsVector<T>* u_ptr = (gsVector<T>*) u;
406  delete u_ptr;
407  return braid_Int(0);
408  }
409 
411  virtual braid_Int Sum(braid_Real alpha,
412  braid_Vector x,
413  braid_Real beta,
414  braid_Vector y)
415  {
416  gsVector<T>* x_ptr = (gsVector<T>*) x;
417  gsVector<T>* y_ptr = (gsVector<T>*) y;
418  *y_ptr = (T)alpha * (*x_ptr) + (T)beta * (*y_ptr);
419  return braid_Int(0);
420  }
421 
423  virtual braid_Int SpatialNorm(braid_Vector u,
424  braid_Real *norm_ptr)
425  {
426  gsVector<T> *u_ptr = (gsVector<T>*) u;
427  *norm_ptr = u_ptr->norm();
428  return braid_Int(0);
429  }
430 
432  virtual braid_Int BufPack(braid_Vector u,
433  void *buffer,
434  BraidBufferStatus &status)
435  {
436  gsVector<T> *u_ptr = (gsVector<T>*) u;
437  T* buffer_ptr = (T*) buffer;
438  T* data_ptr = u_ptr->data();
439  index_t size = u_ptr->size();
440 
441  buffer_ptr[0] = u_ptr->size();
442  for (index_t idx = 0; idx < size; ++idx)
443  buffer_ptr[idx+1] = data_ptr[idx];
444 
445  status.SetSize(sizeof(T)*(size+1));
446  return braid_Int(0);
447  }
448 
450  virtual braid_Int BufUnpack(void *buffer,
451  braid_Vector *u_ptr,
452  BraidBufferStatus &status)
453  {
454  T* buffer_ptr = (T*) buffer;
455  index_t size = buffer_ptr[0];
456  gsVector<T>* u = new gsVector<T>(size);
457  T* data_ptr = u->data();
458 
459  for (index_t idx = 0; idx < size; ++idx)
460  data_ptr[idx] = buffer_ptr[idx+1];
461 
462  *u_ptr = (braid_Vector) u;
463  return braid_Int(0);
464  }
465  };
466 
473  class gsXBraidAccessStatus : public BraidAccessStatus
474  {
475  public:
477  braid_Int iterations() {
478  braid_Int iter;
479  GetIter(&iter);
480  return iter;
481  }
482 
484  braid_Int level() {
485  braid_Int level;
486  GetLevel(&level);
487  return level;
488  }
489 
491  braid_Int levels() {
492  braid_Int nlevels;
493  GetNLevels(&nlevels);
494  return nlevels;
495  }
496 
498  braid_Int refines() {
499  braid_Int nref;
500  GetNRefine(&nref);
501  return nref;
502  }
503 
505  braid_Real time() {
506  braid_Real t;
507  GetT(&t);
508  return t;
509  }
510 
512  braid_Int times() {
513  braid_Int ntpoints;
514  GetNTPoints(&ntpoints);
515  return ntpoints;
516  }
517 
519  bool done() {
520  braid_Int status;
521  GetDone(&status);
522  return bool(status);
523  }
524 
526  braid_Int callingFunction() {
527  braid_Int callingfcn;
528  GetCallingFunction(&callingfcn);
529  return callingfcn;
530  }
531 
533  braid_Int timeIndex() {
534  braid_Int tindex;
535  GetTIndex(&tindex);
536  return tindex;
537  }
538 
540  braid_Int test() {
541  braid_Int wtest;
542  GetWrapperTest(&wtest);
543  return wtest;
544  }
545 
547  braid_Real norm() {
548  braid_Real rnorm;
549  GetResidual(&rnorm);
550  return rnorm;
551  }
552 
554  braid_Real error() {
555  braid_Real errorest;
556  GetSingleErrorEstAccess(&errorest);
557  return errorest;
558  }
559  };
560 
567  class gsXBraidSyncStatus : public BraidSyncStatus
568  {
569  public:
571  braid_Int iterations() {
572  braid_Int iter;
573  GetIter(&iter);
574  return iter;
575  }
576 
578  braid_Int level() {
579  braid_Int level;
580  GetLevel(&level);
581  return level;
582  }
583 
585  braid_Int levels() {
586  braid_Int nlevels;
587  GetNLevels(&nlevels);
588  return nlevels;
589  }
590 
592  braid_Int refines() {
593  braid_Int nref;
594  GetNRefine(&nref);
595  return nref;
596  }
597 
599  braid_Int times() {
600  braid_Int ntpoints;
601  GetNTPoints(&ntpoints);
602  return ntpoints;
603  }
604 
606  bool done() {
607  braid_Int status;
608  GetDone(&status);
609  return bool(status);
610  }
611 
613  braid_Int callingFunction() {
614  braid_Int callingfcn;
615  GetCallingFunction(&callingfcn);
616  return callingfcn;
617  }
618 
620  braid_Real errors() {
621  braid_Real errorest;
622  GetAllErrorEst(&errorest);
623  return errorest;
624  }
625 
627  braid_Int nerrors() {
628  braid_Int numerrorest;
629  GetNumErrorEst(&numerrorest);
630  return numerrorest;
631  }
632  };
633 
640  class gsXBraidStepStatus : public BraidStepStatus
641  {
642  public:
644  braid_Int iterations() {
645  braid_Int iter;
646  GetIter(&iter);
647  return iter;
648  }
649 
651  braid_Int level() {
652  braid_Int level;
653  GetLevel(&level);
654  return level;
655  }
656 
658  braid_Int levels() {
659  braid_Int nlevels;
660  GetNLevels(&nlevels);
661  return nlevels;
662  }
663 
665  braid_Int refines() {
666  braid_Int nref;
667  GetNRefine(&nref);
668  return nref;
669  }
670 
672  braid_Real time() {
673  braid_Real t;
674  GetT(&t);
675  return t;
676  }
677 
679  braid_Int times() {
680  braid_Int ntpoints;
681  GetNTPoints(&ntpoints);
682  return ntpoints;
683  }
684 
686  braid_Real timeStop() {
687  braid_Real t;
688  GetTstop(&t);
689  return t;
690  }
691 
693  std::pair<braid_Real, braid_Real> timeInterval() {
694  std::pair<braid_Real, braid_Real> t;
695  GetTstartTstop(&t.first, &t.second);
696  return t;
697  }
698 
700  braid_Int timeIndex() {
701  braid_Int tindex;
702  GetTIndex(&tindex);
703  return tindex;
704  }
705 
707  braid_Real tol() {
708  braid_Real t;
709  GetTol(&t);
710  return t;
711  }
712 
714  braid_Real tolFine() {
715  braid_Real t;
716  GetOldFineTolx(&t);
717  return t;
718  }
719 
721  braid_Real error() {
722  braid_Real errorest;
723  GetSingleErrorEstStep(&errorest);
724  return errorest;
725  }
726 
728  braid_Real accuracy(braid_Real loose_tol, braid_Real tight_tol) {
729  braid_Real tol;
730  GetSpatialAccuracy(loose_tol, tight_tol, &tol);
731  return tol;
732  }
733  };
734 
741  class gsXBraidCoarsenRefStatus : public BraidCoarsenRefStatus
742  {
743  public:
745  braid_Int iterations() {
746  braid_Int iter;
747  GetIter(&iter);
748  return iter;
749  }
750 
752  braid_Int level() {
753  braid_Int level;
754  GetLevel(&level);
755  return level;
756  }
757 
759  braid_Int levels() {
760  braid_Int nlevels;
761  GetNLevels(&nlevels);
762  return nlevels;
763  }
764 
766  braid_Int refines() {
767  braid_Int nref;
768  GetNRefine(&nref);
769  return nref;
770  }
771 
773  braid_Real time() {
774  braid_Real t;
775  GetT(&t);
776  return t;
777  }
778 
780  braid_Int times() {
781  braid_Int ntpoints;
782  GetNTPoints(&ntpoints);
783  return ntpoints;
784  }
785 
787  braid_Int timeIndex() {
788  braid_Int tindex;
789  GetTIndex(&tindex);
790  return tindex;
791  }
792 
794  braid_Real ftimeStop() {
795  braid_Real t;
796  GetFTstop(&t);
797  return t;
798  }
799 
801  braid_Real ftimeStart() {
802  braid_Real t;
803  GetFTprior(&t);
804  return t;
805  }
806 
808  braid_Real ctimeStop() {
809  braid_Real t;
810  GetCTstop(&t);
811  return t;
812  }
813 
815  braid_Real ctimeStart() {
816  braid_Real t;
817  GetCTprior(&t);
818  return t;
819  }
820  };
821 
828  class gsXBraidBufferStatus : public BraidBufferStatus
829  {
830  public:
832  braid_Int type() {
833  braid_Int msg;
834  GetMessageType(&msg);
835  return msg;
836  }
837  };
838 
845  class gsXBraidObjectiveStatus : public BraidObjectiveStatus
846  {
847  public:
849  braid_Int iterations() {
850  braid_Int iter;
851  GetIter(&iter);
852  return iter;
853  }
854 
856  braid_Int level() {
857  braid_Int level;
858  GetLevel(&level);
859  return level;
860  }
861 
863  braid_Int levels() {
864  braid_Int nlevels;
865  GetNLevels(&nlevels);
866  return nlevels;
867  }
868 
870  braid_Int refines() {
871  braid_Int nref;
872  GetNRefine(&nref);
873  return nref;
874  }
875 
877  braid_Real time() {
878  braid_Real t;
879  GetT(&t);
880  return t;
881  }
882 
884  braid_Int times() {
885  braid_Int ntpoints;
886  GetNTPoints(&ntpoints);
887  return ntpoints;
888  }
889 
891  braid_Int timeIndex() {
892  braid_Int tindex;
893  GetTIndex(&tindex);
894  return tindex;
895  }
896  };
897 
898 }// namespace gismo
899 
900 #ifndef GISMO_BUILD_LIB
901 #include GISMO_HPP_HEADER(gsXBraid.hpp)
902 #endif
void SetPeriodic(braid_Int periodic)
Sets periodic time grid (default is 0)
Definition: gsXBraid.h:136
braid_Int test()
???
Definition: gsXBraid.h:540
braid_Int iterations()
Returns the number of iterations.
Definition: gsXBraid.h:644
void SetTemporalNorm(braid_Int tnorm)
Sets the temporal norm: 1-norm (1), 2-norm (2:default), inf-norm (3)
Definition: gsXBraid.h:127
virtual braid_Int Free(braid_Vector u)
Frees the given vector.
Definition: gsXBraid.h:403
virtual braid_Int BufUnpack(void *buffer, braid_Vector *u_ptr, BraidBufferStatus &status)
Unpacks a vector from the MPI communication buffer.
Definition: gsXBraid.h:450
void SetTPointsCutoff(braid_Int tpoints_cutoff)
Sets the time cutoff.
Definition: gsXBraid.h:226
braid_Int levels()
Returns the total number of multigrid levels.
Definition: gsXBraid.h:863
void solve()
Runs the parallel-in-time multigrid solver.
Definition: gsXBraid.h:93
braid_Int times()
Returns the total number of time instances.
Definition: gsXBraid.h:512
gsXBraid(const gsMpiComm &comm, const braid_Real tstart, const braid_Real tstop, braid_Int ntime)
Constructor.
Definition: gsXBraid.hpp:22
#define GISMO_NO_IMPLEMENTATION
Definition: gsDebug.h:129
virtual braid_Int Clone(braid_Vector u, braid_Vector *v_ptr)
Clones the given vector.
Definition: gsXBraid.h:298
void SetCRelaxWt(braid_Int level, braid_Real Cwt)
Sets the C-relaxation weight.
Definition: gsXBraid.h:223
braid_Real time()
Returns the current time instance.
Definition: gsXBraid.h:505
virtual braid_Int Sum(braid_Real alpha, braid_Vector x, braid_Real beta, braid_Vector y)
Computes the sum of two given vectors.
Definition: gsXBraid.h:317
virtual braid_Int Residual(braid_Vector, braid_Vector, BraidStepStatus &)
Computes the residual (dummy method)
Definition: gsXBraid.h:89
void SetAccessLevel(braid_Int access_level)
Definition: gsXBraid.h:164
Main header to be included by clients using the G+Smo library.
braid_Int times()
Returns the total number of time instances.
Definition: gsXBraid.h:679
Class defining the XBraid coarsen and refinement status wrapper.
Definition: gsXBraid.h:741
braid_Int levels()
Returns the total number of multigrid levels.
Definition: gsXBraid.h:585
virtual braid_Int Free(braid_Vector)
Frees the given vector (dummy method)
Definition: gsXBraid.h:86
void SetNRelax(braid_Int level, braid_Int nrelax)
Definition: gsXBraid.h:114
void SetMaxRefinements(braid_Int max_refinements)
Sets the max number of time grid refinement levels allowed.
Definition: gsXBraid.h:185
braid_Real tol()
Returns the tolerance.
Definition: gsXBraid.h:707
braid_Int nerrors()
Returns the number of estimated errors.
Definition: gsXBraid.h:627
braid_Real ctimeStop()
Returns the end of the coarse time interval.
Definition: gsXBraid.h:808
braid_Int timeIndex()
Returns the index of the time instance.
Definition: gsXBraid.h:891
braid_Int levels()
Returns the total number of multigrid levels.
Definition: gsXBraid.h:759
braid_Int levels()
Returns the total number of multigrid levels.
Definition: gsXBraid.h:491
braid_Int level()
Returns the current multigrid level.
Definition: gsXBraid.h:752
braid_Int levels()
Returns the total number of levels.
Definition: gsXBraid.h:262
braid_Int timeIndex()
Returns the index of the time instance.
Definition: gsXBraid.h:787
bool done()
Returns true if XBraid is completed.
Definition: gsXBraid.h:606
braid_Real time()
Returns the current time instance.
Definition: gsXBraid.h:877
#define index_t
Definition: gsConfig.h:32
braid_Real time()
Returns the current time instance.
Definition: gsXBraid.h:672
braid_Int iterations()
Returns the number of iterations.
Definition: gsXBraid.h:477
void SetRichardsonEstimation(braid_Int est_error, braid_Int richardson, braid_Int local_order)
Definition: gsXBraid.h:203
braid_Int times()
Returns the total number of time instances.
Definition: gsXBraid.h:599
std::pair< braid_Real, braid_Real > timeInterval()
Returns the time interval.
Definition: gsXBraid.h:693
void SetCFactor(braid_Int level, braid_Int cfactor)
Sets the coarsening factor cfactor on grid level (default is 2)
Definition: gsXBraid.h:130
void SetRelTol(braid_Real tol)
Sets relative stopping tolerance.
Definition: gsXBraid.h:124
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition: gsMatrix.h:38
braid_Real errors()
Returns the estimated errors.
Definition: gsXBraid.h:620
braid_Real tolFine()
Returns the old tolerence for the fine-grid solver.
Definition: gsXBraid.h:714
virtual braid_Int BufPack(braid_Vector u, void *buffer, BraidBufferStatus &status)
Packs the given vector into the MPI communication buffer.
Definition: gsXBraid.h:432
void SetMinCoarse(braid_Int min_coarse)
Definition: gsXBraid.h:109
braid_Int timeIndex()
Returns the index of the time instance.
Definition: gsXBraid.h:533
void SetIncrMaxLevels()
Increases the max number of multigrid levels after performing a refinement.
Definition: gsXBraid.h:100
braid_Int iterations()
Returns the number of iterations.
Definition: gsXBraid.h:571
void SetResidual()
Sets user-defined residual routine.
Definition: gsXBraid.h:208
void SetFMG()
Sets FMG (F-cycle)
Definition: gsXBraid.h:167
braid_Int level()
Returns the current multigrid level.
Definition: gsXBraid.h:856
void SetPrintFile(const char *printfile_name)
Sets the output file for runtime print message.
Definition: gsXBraid.h:149
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition: gsVector.h:35
braid_Int refines()
Returns the total number of refinements.
Definition: gsXBraid.h:665
Class defining the XBraid step objective wrapper.
Definition: gsXBraid.h:845
virtual braid_Int BufUnpack(void *buffer, braid_Vector *u_ptr, BraidBufferStatus &status)
Unpacks a vector from the MPI communication buffer.
Definition: gsXBraid.h:357
void SetMaxIter(braid_Int max_iter)
Sets max number of multigrid iterations.
Definition: gsXBraid.h:139
braid_Int level()
Returns the current multigrid level.
Definition: gsXBraid.h:484
braid_Real ctimeStart()
Returns the start of the coarse time interval.
Definition: gsXBraid.h:815
braid_Real norm(braid_Int nrequest)
Returns the residual norm.
Definition: gsXBraid.h:255
braid_Real timeStop()
Returns the end of the time interval.
Definition: gsXBraid.h:686
braid_Int iterations()
Returns the number of iterations.
Definition: gsXBraid.h:849
void SetPrintLevel(braid_Int print_level)
Definition: gsXBraid.h:146
void GetNumIter(braid_Int *niter_ptr)
Gets the number of iterations (XBraid style)
Definition: gsXBraid.h:236
void SetNRelax(braid_Int nrelax)
Definition: gsXBraid.h:118
braid_Int refines()
Returns the total number of refinements.
Definition: gsXBraid.h:592
virtual braid_Int BufPack(braid_Vector u, void *buffer, BraidBufferStatus &status)
Packs the given vector into the MPI communication buffer.
Definition: gsXBraid.h:338
void SetSeqSoln(braid_Int use_seq_soln)
Definition: gsXBraid.h:155
Class defining the XBraid step status wrapper.
Definition: gsXBraid.h:640
braid_Int callingFunction()
???
Definition: gsXBraid.h:613
void SetFullRNormRes(braid_PtFcnResidual residual)
Sets callback function for residual numer calculation.
Definition: gsXBraid.h:229
braid_Real error()
Returns the estimated error.
Definition: gsXBraid.h:721
Class defining the XBraid sync status wrapper.
Definition: gsXBraid.h:567
virtual ~gsXBraid()
Destructor.
Definition: gsXBraid.hpp:32
braid_Int refines()
Returns the total number of refinements.
Definition: gsXBraid.h:498
virtual braid_Int SpatialNorm(braid_Vector u, braid_Real *norm_ptr)
Computes the spatial norm of the given vector.
Definition: gsXBraid.h:329
Class defining the XBraid wrapper.
Definition: gsXBraid.h:73
void SetStorage(braid_Int storage)
Definition: gsXBraid.h:179
braid_Real norm()
Returns the residual norm.
Definition: gsXBraid.h:547
braid_Real error()
Returns the estimated error.
Definition: gsXBraid.h:554
virtual braid_Int Sum(braid_Real alpha, braid_Vector x, braid_Real beta, braid_Vector y)
Computes the sum of two given vectors.
Definition: gsXBraid.h:411
braid_Int level()
Returns the current multigrid level.
Definition: gsXBraid.h:651
braid_Real accuracy(braid_Real loose_tol, braid_Real tight_tol)
Returns the spatial accuracy.
Definition: gsXBraid.h:728
void SetNFMGVcyc(braid_Int nfmg_Vcyc)
Sets the number of V-cycles to do at each FMG level (default is 1)
Definition: gsXBraid.h:173
void SetNFMG(braid_Int k)
Sets the number of initial F-cycles to do before switching to V-cycles.
Definition: gsXBraid.h:170
virtual braid_Int SpatialNorm(braid_Vector u, braid_Real *norm_ptr)
Computes the spatial norm of the given vector.
Definition: gsXBraid.h:423
void SetSync()
Sets user-defined sync routine.
Definition: gsXBraid.h:214
virtual braid_Int Clone(braid_Vector u, braid_Vector *v_ptr)
Clones the given vector.
Definition: gsXBraid.h:392
void SetSpatialCoarsenAndRefine()
Sets user-defined coarsening and refinement routine.
Definition: gsXBraid.h:211
braid_Real ftimeStart()
Returns the start of the fine time interval.
Definition: gsXBraid.h:801
braid_Int type()
Returns the message type.
Definition: gsXBraid.h:832
braid_Int iterations()
Returns the number of iterations.
Definition: gsXBraid.h:745
void GetMyID(braid_Int *myid_ptr)
Gets the MPI process ID.
Definition: gsXBraid.h:245
braid_Int times()
Returns the total number of time instances.
Definition: gsXBraid.h:780
Class defining the XBraid buffer status wrapper.
Definition: gsXBraid.h:828
void SetFileIOLevel(braid_Int io_level)
Sets the file input/output level.
Definition: gsXBraid.h:220
void SetAbsTol(braid_Real tol)
Sets absolute stopping tolerance.
Definition: gsXBraid.h:121
A serial communication class.
Definition: gsMpiComm.h:288
braid_Int refines()
Returns the total number of refinements.
Definition: gsXBraid.h:766
braid_Int iterations()
Returns the number of iterations.
Definition: gsXBraid.h:248
braid_Int timeIndex()
Returns the index of the time instance.
Definition: gsXBraid.h:700
braid_Real ftimeStop()
Returns the end of the fine time interval.
Definition: gsXBraid.h:794
void SetTimeGrid(braid_PtFcnTimeGrid tgrid)
Sets callback function for time grid.
Definition: gsXBraid.h:232
void SetMaxLevels(braid_Int max_levels)
Sets the maximum number of multigrid levels.
Definition: gsXBraid.h:97
void GetNLevels(braid_Int *nlevels_ptr)
Gets the total number of levels (XBraid style)
Definition: gsXBraid.h:242
void SetDefaultPrintFile()
Sets the default print file.
Definition: gsXBraid.h:217
void SetSkip(braid_Int skip)
Sets whether to skip all work on the first down cycle (skip = 1). On by default.
Definition: gsXBraid.h:103
braid_Int refines()
Returns the total number of refinements.
Definition: gsXBraid.h:870
braid_Int levels()
Returns the total number of multigrid levels.
Definition: gsXBraid.h:658
Class defining the XBraid access status wrapper.
Definition: gsXBraid.h:473
virtual braid_Int Free(braid_Vector u)
Frees the given vector.
Definition: gsXBraid.h:309
braid_Int callingFunction()
???
Definition: gsXBraid.h:526
void SetRefine(braid_Int refine)
Turns time refinement on (refine = 1) or off (refine = 0).
Definition: gsXBraid.h:182
BraidCore core
Braid Core object.
Definition: gsXBraid.h:277
braid_Int level()
Returns the current multigrid level.
Definition: gsXBraid.h:578
braid_Int id()
Returns the MPI process ID.
Definition: gsXBraid.h:269
braid_Real time()
Returns the current time instance.
Definition: gsXBraid.h:773
void SetCFactor(braid_Int cfactor)
Sets the coarsening factor cfactor on all grid levels.
Definition: gsXBraid.h:133
void GetRNorms(braid_Int *nrequest_ptr, braid_Real *rnorms)
Gets the residual norm (XBraid style)
Definition: gsXBraid.h:239
bool done()
Returns true if XBraid has completed.
Definition: gsXBraid.h:519
braid_Int times()
Returns the total number of time instances.
Definition: gsXBraid.h:884