19#define braid_SEQUENTIAL 1
22#include <XBraid/braid/braid.hpp>
78 const braid_Real tstart,
79 const braid_Real tstop,
86 virtual braid_Int
Free(braid_Vector) {
return braid_Int(0); }
89 virtual braid_Int
Residual(braid_Vector, braid_Vector, BraidStepStatus&)
114 void SetNRelax(braid_Int level, braid_Int nrelax) {
core.SetNRelax(level, nrelax); }
130 void SetCFactor(braid_Int level, braid_Int cfactor) {
core.SetCFactor(level, cfactor); }
204 {
core.SetRichardsonEstimation(est_error, richardson, local_order); }
239 void GetRNorms(braid_Int *nrequest_ptr, braid_Real *rnorms) {
core.GetRNorms(nrequest_ptr, rnorms); }
255 braid_Real
norm(braid_Int nrequest) {
290 const braid_Real tstart,
291 const braid_Real tstop,
298 virtual braid_Int
Clone(braid_Vector u,
304 *v_ptr = (braid_Vector) v;
309 virtual braid_Int
Free(braid_Vector u)
317 virtual braid_Int
Sum(braid_Real alpha,
324 *y_ptr = (T)alpha * (*x_ptr) + (T)beta * (*y_ptr);
330 braid_Real *norm_ptr)
333 *norm_ptr = u_ptr->norm();
340 BraidBufferStatus &status)
343 T* buffer_ptr = (T*) buffer;
344 T* data_ptr = u_ptr->data();
345 index_t size = u_ptr->rows()*u_ptr->cols();
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];
352 status.SetSize(
sizeof(T)*(size+2));
359 BraidBufferStatus &status)
361 T* buffer_ptr = (T*) buffer;
365 T* data_ptr = u->data();
367 for (
index_t idx = 0; idx < rows*cols; ++idx)
368 data_ptr[idx] = buffer_ptr[idx+2];
370 *u_ptr = (braid_Vector) u;
384 const braid_Real tstart,
385 const braid_Real tstop,
392 virtual braid_Int
Clone(braid_Vector u,
398 *v_ptr = (braid_Vector) v;
403 virtual braid_Int
Free(braid_Vector u)
411 virtual braid_Int
Sum(braid_Real alpha,
418 *y_ptr = (T)alpha * (*x_ptr) + (T)beta * (*y_ptr);
424 braid_Real *norm_ptr)
427 *norm_ptr = u_ptr->norm();
434 BraidBufferStatus &status)
437 T* buffer_ptr = (T*) buffer;
438 T* data_ptr = u_ptr->data();
441 buffer_ptr[0] = u_ptr->size();
442 for (
index_t idx = 0; idx < size; ++idx)
443 buffer_ptr[idx+1] = data_ptr[idx];
445 status.SetSize(
sizeof(T)*(size+1));
452 BraidBufferStatus &status)
454 T* buffer_ptr = (T*) buffer;
457 T* data_ptr = u->data();
459 for (
index_t idx = 0; idx < size; ++idx)
460 data_ptr[idx] = buffer_ptr[idx+1];
462 *u_ptr = (braid_Vector) u;
493 GetNLevels(&nlevels);
514 GetNTPoints(&ntpoints);
527 braid_Int callingfcn;
528 GetCallingFunction(&callingfcn);
542 GetWrapperTest(&wtest);
556 GetSingleErrorEstAccess(&errorest);
587 GetNLevels(&nlevels);
601 GetNTPoints(&ntpoints);
614 braid_Int callingfcn;
615 GetCallingFunction(&callingfcn);
622 GetAllErrorEst(&errorest);
628 braid_Int numerrorest;
629 GetNumErrorEst(&numerrorest);
660 GetNLevels(&nlevels);
681 GetNTPoints(&ntpoints);
694 std::pair<braid_Real, braid_Real> t;
695 GetTstartTstop(&t.first, &t.second);
723 GetSingleErrorEstStep(&errorest);
728 braid_Real
accuracy(braid_Real loose_tol, braid_Real tight_tol) {
730 GetSpatialAccuracy(loose_tol, tight_tol, &
tol);
761 GetNLevels(&nlevels);
782 GetNTPoints(&ntpoints);
834 GetMessageType(&msg);
865 GetNLevels(&nlevels);
886 GetNTPoints(&ntpoints);
900#ifndef GISMO_BUILD_LIB
901#include GISMO_HPP_HEADER(gsXBraid.hpp)
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
A serial communication class.
Definition gsMpiComm.h:289
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
Class defining the XBraid access status wrapper.
Definition gsXBraid.h:474
braid_Int callingFunction()
???
Definition gsXBraid.h:526
braid_Int times()
Returns the total number of time instances.
Definition gsXBraid.h:512
braid_Int test()
???
Definition gsXBraid.h:540
braid_Real norm()
Returns the residual norm.
Definition gsXBraid.h:547
braid_Int level()
Returns the current multigrid level.
Definition gsXBraid.h:484
braid_Real time()
Returns the current time instance.
Definition gsXBraid.h:505
braid_Real error()
Returns the estimated error.
Definition gsXBraid.h:554
braid_Int timeIndex()
Returns the index of the time instance.
Definition gsXBraid.h:533
braid_Int levels()
Returns the total number of multigrid levels.
Definition gsXBraid.h:491
braid_Int refines()
Returns the total number of refinements.
Definition gsXBraid.h:498
bool done()
Returns true if XBraid has completed.
Definition gsXBraid.h:519
braid_Int iterations()
Returns the number of iterations.
Definition gsXBraid.h:477
Class defining the XBraid buffer status wrapper.
Definition gsXBraid.h:829
braid_Int type()
Returns the message type.
Definition gsXBraid.h:832
Class defining the XBraid coarsen and refinement status wrapper.
Definition gsXBraid.h:742
braid_Real ctimeStop()
Returns the end of the coarse time interval.
Definition gsXBraid.h:808
braid_Int times()
Returns the total number of time instances.
Definition gsXBraid.h:780
braid_Int level()
Returns the current multigrid level.
Definition gsXBraid.h:752
braid_Real time()
Returns the current time instance.
Definition gsXBraid.h:773
braid_Int timeIndex()
Returns the index of the time instance.
Definition gsXBraid.h:787
braid_Int levels()
Returns the total number of multigrid levels.
Definition gsXBraid.h:759
braid_Real ftimeStop()
Returns the end of the fine time interval.
Definition gsXBraid.h:794
braid_Int refines()
Returns the total number of refinements.
Definition gsXBraid.h:766
braid_Real ctimeStart()
Returns the start of the coarse time interval.
Definition gsXBraid.h:815
braid_Int iterations()
Returns the number of iterations.
Definition gsXBraid.h:745
braid_Real ftimeStart()
Returns the start of the fine time interval.
Definition gsXBraid.h:801
Class defining the XBraid step objective wrapper.
Definition gsXBraid.h:846
braid_Int times()
Returns the total number of time instances.
Definition gsXBraid.h:884
braid_Int level()
Returns the current multigrid level.
Definition gsXBraid.h:856
braid_Real time()
Returns the current time instance.
Definition gsXBraid.h:877
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:863
braid_Int refines()
Returns the total number of refinements.
Definition gsXBraid.h:870
braid_Int iterations()
Returns the number of iterations.
Definition gsXBraid.h:849
Class defining the XBraid step status wrapper.
Definition gsXBraid.h:641
braid_Real accuracy(braid_Real loose_tol, braid_Real tight_tol)
Returns the spatial accuracy.
Definition gsXBraid.h:728
braid_Real tol()
Returns the tolerance.
Definition gsXBraid.h:707
braid_Int times()
Returns the total number of time instances.
Definition gsXBraid.h:679
braid_Int level()
Returns the current multigrid level.
Definition gsXBraid.h:651
braid_Real timeStop()
Returns the end of the time interval.
Definition gsXBraid.h:686
braid_Real time()
Returns the current time instance.
Definition gsXBraid.h:672
braid_Real error()
Returns the estimated error.
Definition gsXBraid.h:721
std::pair< braid_Real, braid_Real > timeInterval()
Returns the time interval.
Definition gsXBraid.h:693
braid_Int timeIndex()
Returns the index of the time instance.
Definition gsXBraid.h:700
braid_Int levels()
Returns the total number of multigrid levels.
Definition gsXBraid.h:658
braid_Int refines()
Returns the total number of refinements.
Definition gsXBraid.h:665
braid_Int iterations()
Returns the number of iterations.
Definition gsXBraid.h:644
braid_Real tolFine()
Returns the old tolerence for the fine-grid solver.
Definition gsXBraid.h:714
Class defining the XBraid sync status wrapper.
Definition gsXBraid.h:568
braid_Int callingFunction()
???
Definition gsXBraid.h:613
braid_Int times()
Returns the total number of time instances.
Definition gsXBraid.h:599
braid_Int level()
Returns the current multigrid level.
Definition gsXBraid.h:578
braid_Int nerrors()
Returns the number of estimated errors.
Definition gsXBraid.h:627
braid_Real errors()
Returns the estimated errors.
Definition gsXBraid.h:620
braid_Int levels()
Returns the total number of multigrid levels.
Definition gsXBraid.h:585
braid_Int refines()
Returns the total number of refinements.
Definition gsXBraid.h:592
bool done()
Returns true if XBraid is completed.
Definition gsXBraid.h:606
braid_Int iterations()
Returns the number of iterations.
Definition gsXBraid.h:571
virtual braid_Int BufPack(braid_Vector u, void *buffer, BraidBufferStatus &status)
Packs the given vector into the MPI communication buffer.
Definition gsXBraid.h:338
virtual braid_Int Free(braid_Vector u)
Frees the given vector.
Definition gsXBraid.h:309
virtual braid_Int BufUnpack(void *buffer, braid_Vector *u_ptr, BraidBufferStatus &status)
Unpacks a vector from the MPI communication buffer.
Definition gsXBraid.h:357
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 Clone(braid_Vector u, braid_Vector *v_ptr)
Clones the given vector.
Definition gsXBraid.h:298
virtual braid_Int SpatialNorm(braid_Vector u, braid_Real *norm_ptr)
Computes the spatial norm of the given vector.
Definition gsXBraid.h:329
virtual braid_Int BufPack(braid_Vector u, void *buffer, BraidBufferStatus &status)
Packs the given vector into the MPI communication buffer.
Definition gsXBraid.h:432
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
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
virtual braid_Int Clone(braid_Vector u, braid_Vector *v_ptr)
Clones the given vector.
Definition gsXBraid.h:392
virtual braid_Int SpatialNorm(braid_Vector u, braid_Real *norm_ptr)
Computes the spatial norm of the given vector.
Definition gsXBraid.h:423
Class defining the XBraid wrapper.
Definition gsXBraid.h:74
BraidCore core
Braid Core object.
Definition gsXBraid.h:277
void SetStorage(braid_Int storage)
Definition gsXBraid.h:179
virtual ~gsXBraid()
Destructor.
Definition gsXBraid.hpp:32
void SetSync()
Sets user-defined sync routine.
Definition gsXBraid.h:214
void SetSpatialCoarsenAndRefine()
Sets user-defined coarsening and refinement routine.
Definition gsXBraid.h:211
void SetMaxRefinements(braid_Int max_refinements)
Sets the max number of time grid refinement levels allowed.
Definition gsXBraid.h:185
virtual braid_Int Free(braid_Vector)
Frees the given vector (dummy method)
Definition gsXBraid.h:86
void SetRichardsonEstimation(braid_Int est_error, braid_Int richardson, braid_Int local_order)
Definition gsXBraid.h:203
void SetFMG()
Sets FMG (F-cycle)
Definition gsXBraid.h:167
void SetTPointsCutoff(braid_Int tpoints_cutoff)
Sets the time cutoff.
Definition gsXBraid.h:226
void SetPeriodic(braid_Int periodic)
Sets periodic time grid (default is 0)
Definition gsXBraid.h:136
void GetMyID(braid_Int *myid_ptr)
Gets the MPI process ID.
Definition gsXBraid.h:245
void SetResidual()
Sets user-defined residual routine.
Definition gsXBraid.h:208
void SetMinCoarse(braid_Int min_coarse)
Definition gsXBraid.h:109
void SetCFactor(braid_Int cfactor)
Sets the coarsening factor cfactor on all grid levels.
Definition gsXBraid.h:133
void GetNumIter(braid_Int *niter_ptr)
Gets the number of iterations (XBraid style)
Definition gsXBraid.h:236
void SetDefaultPrintFile()
Sets the default print file.
Definition gsXBraid.h:217
braid_Real norm(braid_Int nrequest)
Returns the residual norm.
Definition gsXBraid.h:255
void SetMaxLevels(braid_Int max_levels)
Sets the maximum number of multigrid levels.
Definition gsXBraid.h:97
void SetAbsTol(braid_Real tol)
Sets absolute stopping tolerance.
Definition gsXBraid.h:121
void GetNLevels(braid_Int *nlevels_ptr)
Gets the total number of levels (XBraid style)
Definition gsXBraid.h:242
void SetCFactor(braid_Int level, braid_Int cfactor)
Sets the coarsening factor cfactor on grid level (default is 2)
Definition gsXBraid.h:130
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 SetRefine(braid_Int refine)
Turns time refinement on (refine = 1) or off (refine = 0).
Definition gsXBraid.h:182
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
virtual braid_Int Residual(braid_Vector, braid_Vector, BraidStepStatus &)
Computes the residual (dummy method)
Definition gsXBraid.h:89
void SetSeqSoln(braid_Int use_seq_soln)
Definition gsXBraid.h:155
void SetIncrMaxLevels()
Increases the max number of multigrid levels after performing a refinement.
Definition gsXBraid.h:100
void SetFileIOLevel(braid_Int io_level)
Sets the file input/output level.
Definition gsXBraid.h:220
void SetPrintFile(const char *printfile_name)
Sets the output file for runtime print message.
Definition gsXBraid.h:149
void SetNRelax(braid_Int nrelax)
Definition gsXBraid.h:118
void SetRelTol(braid_Real tol)
Sets relative stopping tolerance.
Definition gsXBraid.h:124
void SetMaxIter(braid_Int max_iter)
Sets max number of multigrid iterations.
Definition gsXBraid.h:139
void SetTimeGrid(braid_PtFcnTimeGrid tgrid)
Sets callback function for time grid.
Definition gsXBraid.h:232
braid_Int levels()
Returns the total number of levels.
Definition gsXBraid.h:262
void SetTemporalNorm(braid_Int tnorm)
Sets the temporal norm: 1-norm (1), 2-norm (2:default), inf-norm (3)
Definition gsXBraid.h:127
braid_Int id()
Returns the MPI process ID.
Definition gsXBraid.h:269
void SetFullRNormRes(braid_PtFcnResidual residual)
Sets callback function for residual numer calculation.
Definition gsXBraid.h:229
void SetPrintLevel(braid_Int print_level)
Definition gsXBraid.h:146
void SetNFMG(braid_Int k)
Sets the number of initial F-cycles to do before switching to V-cycles.
Definition gsXBraid.h:170
void SetNRelax(braid_Int level, braid_Int nrelax)
Definition gsXBraid.h:114
void GetRNorms(braid_Int *nrequest_ptr, braid_Real *rnorms)
Gets the residual norm (XBraid style)
Definition gsXBraid.h:239
braid_Int iterations()
Returns the number of iterations.
Definition gsXBraid.h:248
void SetCRelaxWt(braid_Int level, braid_Real Cwt)
Sets the C-relaxation weight.
Definition gsXBraid.h:223
void solve()
Runs the parallel-in-time multigrid solver.
Definition gsXBraid.h:93
void SetAccessLevel(braid_Int access_level)
Definition gsXBraid.h:164
Main header to be included by clients using the G+Smo library.
#define index_t
Definition gsConfig.h:32
#define GISMO_NO_IMPLEMENTATION
Definition gsDebug.h:129
The G+Smo namespace, containing all definitions for the library.