ProblemScal.cc 18.8 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
#include "ProblemScal.h"
#include "AbstractFunction.h"
#include "DirichletBC.h"
#include "RobinBC.h"
#include "FixVec.h"
#include "Flag.h"
#include "Serializer.h"
#include "RecoveryEstimator.h"
#include "Operator.h"
#include "DOFMatrix.h"
#include "FiniteElemSpace.h"
#include "Estimator.h"
#include "OEMSolver.h"
#include "Preconditioner.h"
#include "MatVecMultiplier.h"
#include "DOFVector.h"
#include "Marker.h"
#include "AdaptInfo.h"
#include "ElInfo.h"
#include "FileWriter.h"
#include "RefinementManager.h"
#include "CoarseningManager.h"
#include "Lagrange.h"
#include "PeriodicBC.h"
#include "ValueReader.h"

namespace AMDiS {

  ProblemScal *ProblemScal::traversePtr_ = NULL;

  void ProblemScal::writeFiles(AdaptInfo *adaptInfo, bool force) {
    ::std::list<FileWriterInterface*>::iterator it;
    for(it = fileWriters_.begin(); it != fileWriters_.end(); ++it) {
      (*it)->writeFiles(adaptInfo, force);
    }
  }

  void ProblemScal::interpolInitialSolution(AbstractFunction<double, WorldVector<double> > *fct) 
  {
    solution_->interpol(fct);
  }

  void ProblemScal::addMatrixOperator(Operator *op, 
				      double *factor,
				      double *estFactor) 
  {
    systemMatrix_->addOperator(op, factor, estFactor);
  }

  void ProblemScal::addVectorOperator(Operator *op, 
				      double *factor,
				      double *estFactor) 
  {
    rhs_->addOperator(op, factor, estFactor);
  }
  
  void ProblemScal::addDirichletBC(BoundaryType type, 
				   AbstractFunction<double, WorldVector<double> >* b) 
  {
    DirichletBC *dirichlet = new DirichletBC(type, b, feSpace_);
    if(systemMatrix_) 
      systemMatrix_->getBoundaryManager()->addBoundaryCondition(dirichlet);
    if(rhs_) 
      rhs_->getBoundaryManager()->addBoundaryCondition(dirichlet);
    if(solution_)
      solution_->getBoundaryManager()->addBoundaryCondition(dirichlet);
  }

  void ProblemScal::addDirichletBC(BoundaryType type, 
				   DOFVector<double> *vec) 
  {
    DirichletBC *dirichlet = new DirichletBC(type, vec);
    if(systemMatrix_) 
      systemMatrix_->getBoundaryManager()->addBoundaryCondition(dirichlet);
    if(rhs_) 
      rhs_->getBoundaryManager()->addBoundaryCondition(dirichlet);
    if(solution_)
      solution_->getBoundaryManager()->addBoundaryCondition(dirichlet);
  }

  void ProblemScal::addRobinBC(BoundaryType type, 
			       AbstractFunction<double, WorldVector<double> > *n,
			       AbstractFunction<double, WorldVector<double> > *r)
  {
    RobinBC *robin = new RobinBC(type, n, r, feSpace_);
    if(rhs_) 
      rhs_->getBoundaryManager()->addBoundaryCondition(robin);
    if(systemMatrix_)
      systemMatrix_->getBoundaryManager()->addBoundaryCondition(robin);
  }

  void ProblemScal::addNeumannBC(BoundaryType type, 
				 AbstractFunction<double, WorldVector<double> > *n)
  {
    NeumannBC *neumann = new NeumannBC(type, n, feSpace_);
    if(rhs_) 
      rhs_->getBoundaryManager()->addBoundaryCondition(neumann);
  }

  void ProblemScal::addRobinBC(BoundaryType type, 
			       DOFVector<double> *n,
			       DOFVector<double> *r)
  {
    RobinBC *robin = new RobinBC(type, n, r, feSpace_);
    if(rhs_) 
      rhs_->getBoundaryManager()->addBoundaryCondition(robin);
    if(systemMatrix_)
      systemMatrix_->getBoundaryManager()->addBoundaryCondition(robin);
  }

  void ProblemScal::addPeriodicBC(BoundaryType type) 
  {
    PeriodicBC *periodic = new PeriodicBC(type, feSpace_);

    //   TEST_EXIT(mesh_->getPeriodicBCMap()[type] == NULL)
    //     ("periodic condition already set in mesh\n");
    //   mesh_->getPeriodicBCMap()[type] = periodic;

    if(systemMatrix_) 
      systemMatrix_->getBoundaryManager()->addBoundaryCondition(periodic);
    if(rhs_) 
      rhs_->getBoundaryManager()->addBoundaryCondition(periodic);
  }

  void ProblemScal::createMesh()
  {
    TEST_EXIT(Parameters::initialized())("parameters not initialized\n");

    // === create problems mesh ===
    ::std::string meshName("");

    GET_PARAMETER(0, name_ + "->info", "%d", &info_);

    GET_PARAMETER(0, name_ + "->mesh", &meshName);

    TEST_EXIT(meshName != "")
      ("no mesh name spezified\n");

    // get problem dimension
    int dim = 0;
    GET_PARAMETER(0, name_ + "->dim", "%d", &dim);
    TEST_EXIT(dim)("no problem dimension spezified!\n");

    // create the mesh
    mesh_ = NEW Mesh(meshName, dim);

    switch(dim) {
    case 1:
      coarseningManager_ = NEW CoarseningManager1d();
      refinementManager_ = NEW RefinementManager1d();
      break;
    case 2:
      coarseningManager_ = NEW CoarseningManager2d();
      refinementManager_ = NEW RefinementManager2d();
      break;
    case 3:
      coarseningManager_ = NEW CoarseningManager3d();
      refinementManager_ = NEW RefinementManager3d();
      break;
    default:
      ERROR_EXIT("invalid dim!\n");
    }
  }

  Flag ProblemScal::markElements(AdaptInfo *adaptInfo) 
  { 
    if(marker_)
      return marker_->markMesh(adaptInfo, mesh_);
    else
      WARNING("no marker\n");
    return 0;
  }

  Flag ProblemScal::refineMesh(AdaptInfo *adaptInfo) 
  { 
    return refinementManager_->refineMesh(mesh_); 
  }

  Flag ProblemScal::coarsenMesh(AdaptInfo *adaptInfo) 
  {
    if(adaptInfo->isCoarseningAllowed(0))
      return coarseningManager_->coarsenMesh(mesh_);
    else {
      WARNING("coarsening not allowed\n");
      return 0;
    }
  }

  void ProblemScal::solve(AdaptInfo *adaptInfo) 
  {
    FUNCNAME("Problem::solve()");
    if(!solver_) {
      WARNING("no solver\n");
      return;
    }

#ifdef _OPENMP
    double wtime = omp_get_wtime();
#endif

    clock_t first = clock();
    int iter = solver_->solve(matVec_, solution_, rhs_, leftPrecon_, rightPrecon_); 

#ifdef _OPENMP
    INFO(info_, 8)("solution of discrete system needed %.5f seconds system time / %.5f seconds wallclock time\n",
		   TIME_USED(first, clock()),
		   omp_get_wtime() - wtime);
#else
    INFO(info_, 8)("solution of discrete system needed %.5f seconds\n",
		   TIME_USED(first, clock()));
#endif

    adaptInfo->setSolverIterations(iter);
    adaptInfo->setMaxSolverIterations(solver_->getMaxIterations());
    adaptInfo->setSolverTolerance(solver_->getTolerance());
    adaptInfo->setSolverResidual(solver_->getResidual());
  }

  void ProblemScal::initialize(Flag initFlag,
			       ProblemScal *adoptProblem,
			       Flag adoptFlag) 
  {
    FUNCNAME("Problem::initialize()");

    // === create mesh ===
    if(mesh_) { 
      WARNING("mesh already created\n");
    } else {
      if(initFlag.isSet(CREATE_MESH) || 
	 ((!adoptFlag.isSet(INIT_MESH))&&
	  (initFlag.isSet(INIT_SYSTEM)||initFlag.isSet(INIT_FE_SPACE)))) 
	{
	  createMesh();
	} 
      if(adoptProblem && 
	 (adoptFlag.isSet(INIT_MESH) || 
	  adoptFlag.isSet(INIT_SYSTEM) ||
	  adoptFlag.isSet(INIT_FE_SPACE)))
	{
	  TEST_EXIT(!mesh_)("mesh already created\n");
	  mesh_ = adoptProblem->getMesh();
	  refinementManager_ = adoptProblem->refinementManager_;
	  coarseningManager_ = adoptProblem->coarseningManager_;
	}
    }

    if(!mesh_) WARNING("no mesh created\n");

    // === create fespace ===
    if(feSpace_) {
      WARNING("feSpace already created\n");
    } else {
      if(initFlag.isSet(INIT_FE_SPACE) || (initFlag.isSet(INIT_SYSTEM)&&!adoptFlag.isSet(INIT_FE_SPACE))) {
	createFESpace();
      } 
      if(adoptProblem &&
	 (adoptFlag.isSet(INIT_FE_SPACE) || adoptFlag.isSet(INIT_SYSTEM))) 
	{
	  TEST_EXIT(!feSpace_)("feSpace already created");
	  feSpace_ = dynamic_cast<ProblemScal*>(adoptProblem)->getFESpace();
	}
    }

    if(!feSpace_) WARNING("no feSpace created\n");

    // === create system ===
    if (initFlag.isSet(INIT_SYSTEM)) {
      createMatricesAndVectors();
    } 
    if (adoptProblem && adoptFlag.isSet(INIT_SYSTEM)) {
      TEST_EXIT(!solution_)("solution already created\n");
      TEST_EXIT(!rhs_)("rhs already created\n");
      TEST_EXIT(!systemMatrix_)("systemMatrix already created\n");
      solution_ = adoptProblem->getSolution();
      rhs_ = adoptProblem->getRHS();
      systemMatrix_  = adoptProblem->getSystemMatrix();
    }

    // === create solver ===
    if (solver_) {
      WARNING("solver already created\n");
    } else {
      if (initFlag.isSet(INIT_SOLVER)) {
	createSolver();
      } 
      if (adoptProblem && adoptFlag.isSet(INIT_SOLVER)) {
	TEST_EXIT(!solver_)("solver already created\n");
	solver_ = adoptProblem->getSolver();
      }
    }

    if (!solver_) 
      WARNING("no solver created\n");

    // === create estimator ===
    if(estimator_) {
      WARNING("estimator already created\n");
    } else {
      if(initFlag.isSet(INIT_ESTIMATOR)) {
	createEstimator();
      } 
      if(adoptProblem && adoptFlag.isSet(INIT_ESTIMATOR)) {
	TEST_EXIT(!estimator_)("estimator already created\n");
	estimator_ = adoptProblem->getEstimator();
      } 
    }

    if(!estimator_) WARNING("no estimator created\n");

    // === create marker ===
    if(marker_) {
      WARNING("marker already created\n");
    } else {
      if(initFlag.isSet(INIT_MARKER)) {
	createMarker();
      } 
      if(adoptProblem && adoptFlag.isSet(INIT_MARKER)) {
	TEST_EXIT(!marker_)("marker already created\n");
	marker_ = adoptProblem->getMarker();
      } 
    }

    if(!marker_) WARNING("no marker created\n");

    // === create file writer ===
    if(initFlag.isSet(INIT_FILEWRITER)) {
      createFileWriter();
    }

  

    // === read serialization and init mesh ===

    // There are two possiblities where the user can define a serialization
    // to be read from disk. Either by providing the parameter -rs when executing
    // the program or in the init file. The -rs parameter is always checked first,
    // because it can be added automatically when  rescheduling the program
    // before timeout of the runqueue.

    int readSerialization = 0;
    ::std::string serializationFilename = "";
    GET_PARAMETER(0, "argv->rs", &serializationFilename);

    // If the parameter -rs is set, we do nothing here, because the problem will be
    // deserialized in the constructor of a following AdaptInstationary initialization.
    if (!serializationFilename.compare("")) {
      GET_PARAMETER(0, name_ + "->input->read serialization", "%d", 
		    &readSerialization);
      if (readSerialization) {
	GET_PARAMETER(0, name_ + "->input->serialization filename", 
		      &serializationFilename);
	TEST_EXIT(serializationFilename != "")("no serialization file\n");

	MSG("Deserialization from file: %s\n", serializationFilename.c_str());
	::std::ifstream in(serializationFilename.c_str());
	deserialize(in);
	in.close();
      } else {
	if (initFlag.isSet(INIT_MESH) && mesh_ && !mesh_->isInitialized()) {
	  mesh_->initialize();
	}
    
	// === read value file and use it for the mesh values ===
	::std::string valueFilename("");
	GET_PARAMETER(0, mesh_->getName() + "->value file name", &valueFilename);     
	if (valueFilename.length()) {     
	  ValueReader::readValue(valueFilename.c_str(),
				 mesh_,
				 solution_,
				 mesh_->getMacroFileInfo());
	  mesh_->clearMacroFileInfo();
	}
	
	
	// === do global refinements ===
	int globalRefinements = 0;
	GET_PARAMETER(0, mesh_->getName() + "->global refinements", "%d", &globalRefinements);
	refinementManager_->globalRefine(mesh_, globalRefinements);	
      }
    }
  }

  void ProblemScal::createFESpace()
  {
    // create finite element space
    int degree = 1;
    GET_PARAMETER(0, name_ + "->polynomial degree" ,"%d", &degree);
    feSpace_ = FiniteElemSpace::provideFESpace(NULL,
					       Lagrange::getLagrange(mesh_->getDim(), degree),
					       mesh_,
					       name_ + "->feSpace");  

    // create dof admin for vertex dofs if neccessary
    if (mesh_->getNumberOfDOFs(VERTEX) == 0) {
      DimVec<int> ln_dof(mesh_->getDim(), DEFAULT_VALUE, 0);
      ln_dof[VERTEX]= 1;
      mesh_->createDOFAdmin("vertex dofs", ln_dof);
    }
  }

  void ProblemScal::createMatricesAndVectors()
  {
    // === create vectors and system matrix ===
    systemMatrix_ = NEW DOFMatrix(feSpace_, feSpace_, "system matrix");
    rhs_          = NEW DOFVector<double>(feSpace_, "rhs");
    solution_     = NEW DOFVector<double>(feSpace_, "solution");

    solution_->refineInterpol(true);
    solution_->setCoarsenOperation(COARSE_INTERPOL);
    solution_->set(0.0);      /*  initialize u_h  !                      */

    // === create matVec ===
    matVec_ = NEW StandardMatVec<DOFMatrix, DOFVector<double> >(systemMatrix_);
  }

  void ProblemScal::createSolver()
  {
    // === create solver ===
    ::std::string solverType("no");
    GET_PARAMETER(0, name_ + "->solver", &solverType);
    OEMSolverCreator<DOFVector<double> > *solverCreator = 
      dynamic_cast<OEMSolverCreator<DOFVector<double> >*>(
							  CreatorMap<OEMSolver<DOFVector<double> > >::getCreator(solverType));
    TEST_EXIT(solverCreator)("no solver type\n");
    solverCreator->setName(name_ + "->solver");
    solver_ = solverCreator->create();
    solver_->initParameters();

    // === create preconditioners ===
    ::std::string preconType("no");
    Preconditioner<DOFVector<double> > *precon;
    GET_PARAMETER(0, name_ + "->solver->left precon", &preconType);
    CreatorInterface<PreconditionerScal> *preconCreator = 
      CreatorMap<PreconditionerScal>::getCreator(preconType);

    if (!preconCreator->isNullCreator()) {
      dynamic_cast<PreconditionerScalCreator*>(preconCreator)->setSizeAndRow(1, 0);
      dynamic_cast<PreconditionerScalCreator*>(preconCreator)->setName(name_ + "->solver->left precon");
    }
  
    precon = preconCreator->create();

    if (precon) {
      dynamic_cast<PreconditionerScal*>(precon)->setMatrix(&systemMatrix_);
      leftPrecon_ = precon;
    }

    preconType.assign("no");
    GET_PARAMETER(0, name_ + "->solver->right precon", &preconType);
    preconCreator = CreatorMap<PreconditionerScal>::getCreator(preconType);

    if (!preconCreator->isNullCreator()) {
      dynamic_cast<PreconditionerScalCreator*>(preconCreator)->setSizeAndRow(1, 0);
      dynamic_cast<PreconditionerScalCreator*>(preconCreator)->setName(name_ + "->solver->left precon");
    }

    precon = preconCreator->create();
    if (precon) {
      dynamic_cast<PreconditionerScal*>(precon)->setMatrix(&systemMatrix_);
      rightPrecon_ = precon;
    }

    // === create vector creator ===
    solver_->setVectorCreator(new DOFVector<double>::Creator(feSpace_));

  }

  void ProblemScal::createEstimator()
  {
    // create and set leaf data prototype
    mesh_->
      setElementDataPrototype(NEW LeafDataEstimatable(NEW LeafDataCoarsenable));

    // create estimator
    //estimator = NEW ResidualEstimator(name + "->estimator");

    // === create estimator ===
    ::std::string estimatorType("no");
    GET_PARAMETER(0, name_ + "->estimator", &estimatorType);
    EstimatorCreator *estimatorCreator = 
      dynamic_cast<EstimatorCreator*>(
				      CreatorMap<Estimator>::getCreator(estimatorType));
    if(estimatorCreator) {
      estimatorCreator->setName(name_ + "->estimator");
      if(estimatorType == "recovery") {
	dynamic_cast<RecoveryEstimator::Creator*>(estimatorCreator)->setSolution(solution_);
      }
      estimator_ = estimatorCreator->create();

      // init estimator
      estimator_->addSystem(systemMatrix_, solution_, rhs_);
    }
  }

  void ProblemScal::createMarker()
  {
    marker_ = dynamic_cast<Marker*>(Marker::createMarker(name_ + "->marker", -1));
  }

  void ProblemScal::createFileWriter()
  {
    fileWriters_.push_back(NEW FileWriter(name_ + "->output", mesh_, solution_));
    int writeSerialization = 0;
    GET_PARAMETER(0, name_ + "->output->write serialization", "%d", 
		  &writeSerialization);
    if(writeSerialization) {
      fileWriters_.push_back(NEW Serializer<ProblemScal>(this));
    }
  }

  void ProblemScal::estimate(AdaptInfo *adaptInfo) 
  {
    FUNCNAME("Problem::estimate()");

    if(estimator_) {
      clock_t first = clock();
      estimator_->estimate(adaptInfo->getTimestep());
      INFO(info_,8)("estimation of the error needed %.5f seconds\n",
		    TIME_USED(first,clock()));

      adaptInfo->setEstSum(estimator_->getErrorSum(), 0);

      adaptInfo->
	setTimeEstSum(estimator_->getTimeEst(), 0);

      adaptInfo->
	setEstMax(estimator_->getErrorMax(), 0);

      adaptInfo->
	setTimeEstMax(estimator_->getTimeEstMax(), 0);

    } else {
      WARNING("no estimator\n");
    }
  }

  void ProblemScal::buildAfterCoarsen(AdaptInfo *adaptInfo, Flag flag)
  {
    FUNCNAME("ProblemScal::buildAfterCoarsen");

    clock_t first = clock();

    mesh_->dofCompress();

    MSG("%d DOFs for %s\n", 
	feSpace_->getAdmin()->getUsedSize(), 
	feSpace_->getName().c_str());

    Flag assembleFlag = 
      flag | 
      systemMatrix_->getAssembleFlag() | 
      rhs_->getAssembleFlag();

    if (useGetBound_)
      assembleFlag |= Mesh::FILL_BOUND;

    systemMatrix_->clear();
    rhs_->set(0.0);

    traversePtr_ = this;

    mesh_->traverse(-1, assembleFlag, &buildAfterCoarsenFct);

    // fill boundary conditions
    if (systemMatrix_->getBoundaryManager())
      systemMatrix_->getBoundaryManager()->initMatrix(systemMatrix_);
    if (rhs_->getBoundaryManager())
      rhs_->getBoundaryManager()->initVector(rhs_);
    if (solution_->getBoundaryManager())
      solution_->getBoundaryManager()->initVector(solution_);

    TraverseStack stack;
    ElInfo *elInfo = stack.traverseFirst(mesh_, -1, 
					 Mesh::CALL_LEAF_EL | 
					 Mesh::FILL_BOUND |
					 Mesh::FILL_COORDS |
					 Mesh::FILL_DET |
					 Mesh::FILL_GRD_LAMBDA |
					 Mesh::FILL_NEIGH);
    // for all elements ...
    while (elInfo) {
      if (systemMatrix_->getBoundaryManager())
	systemMatrix_->getBoundaryManager()->fillBoundaryConditions(elInfo, systemMatrix_);
      if (rhs_->getBoundaryManager())
	rhs_->getBoundaryManager()->fillBoundaryConditions(elInfo, rhs_);
      if (solution_->getBoundaryManager())
	solution_->getBoundaryManager()->fillBoundaryConditions(elInfo, solution_);

      elInfo = stack.traverseNext(elInfo);
    }

    if (systemMatrix_->getBoundaryManager())
      systemMatrix_->getBoundaryManager()->exitMatrix(systemMatrix_);
    if (rhs_->getBoundaryManager())
      rhs_->getBoundaryManager()->exitVector(rhs_);
    if (solution_->getBoundaryManager())
      solution_->getBoundaryManager()->exitVector(solution_);

    INFO(info_, 8)("buildAfterCoarsen needed %.5f seconds\n",
		   TIME_USED(first,clock()));

    //    ::std::cout << "Speicherverbrauch: " << memSizeStr(systemMatrix_->memsize()) << ::std::endl;

    return;
  }

  int ProblemScal::buildAfterCoarsenFct(ElInfo *elInfo) 
  {
    const BoundaryType *bound;

    if (traversePtr_->getBoundUsed())
      bound = traversePtr_->getFESpace()->getBasisFcts()->getBound(elInfo, NULL);
    else
      bound = NULL;
  
    traversePtr_->getSystemMatrix()->assemble(1.0, elInfo, bound);
    traversePtr_->getRHS()->assemble(1.0, elInfo, bound);

    return 0;
  }

  void ProblemScal::serialize(::std::ostream &out) 
  {
    FUNCNAME("ProblemScal::serialize()");

    mesh_->serialize(out);
    solution_->serialize(out);
  }

  void ProblemScal::deserialize(::std::istream &in) 
  {
    FUNCNAME("ProblemScal::deserialize()");

    mesh_->deserialize(in);    
    solution_->deserialize(in);
  }

}