Skip to content
Snippets Groups Projects
ProblemVec.cc 48.73 KiB
#include <sstream>
#include <boost/lexical_cast.hpp>
#include "ProblemVec.h"
#include "RecoveryEstimator.h"
#include "Serializer.h"
#include "AbstractFunction.h"
#include "Operator.h"
#include "SystemVector.h"
#include "DOFMatrix.h"
#include "FiniteElemSpace.h"
#include "Estimator.h"
#include "Marker.h"
#include "AdaptInfo.h"
#include "FileWriter.h"
#include "CoarseningManager.h"
#include "RefinementManager.h"
#include "DualTraverse.h"
#include "Mesh.h"
#include "OEMSolver.h"
#include "DirichletBC.h"
#include "RobinBC.h"
#include "PeriodicBC.h"
#include "Lagrange.h"
#include "Flag.h"
#include "TraverseParallel.h"
#include "VtkWriter.h"
#include "ValueReader.h"
#include "ProblemVecDbg.h"
#include "Debug.h"

namespace AMDiS {

  using boost::lexical_cast;

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

    // === create meshes ===
    if (meshes.size() != 0) { 
      WARNING("meshes 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))) {
	meshes = adoptProblem->getMeshes();
	componentMeshes = adoptProblem->componentMeshes;
	refinementManager = adoptProblem->refinementManager;
	coarseningManager = adoptProblem->coarseningManager;

	// If the adopt problem has fewer components than this problem, but only one
	// mesh for all component, than scal up the componentMeshes array.
	if (adoptProblem->getNumComponents() < nComponents) {
	  TEST_EXIT(meshes.size() == 1)("Daran muss ich noch arbeiten!\n");
	  
	  componentMeshes.resize(nComponents);
	  for (int i = adoptProblem->getNumComponents(); i < nComponents; i++)
	    componentMeshes[i] = componentMeshes[0];
	}

      }
    }