Exemplo n.º 1
0
 MyVTKOutput<D>::MyVTKOutput(const Array<shared_ptr<CoefficientFunction>> & a_coefs,
                             const Flags & flags,
                             shared_ptr<MeshAccess> ama)
   : MyVTKOutput(ama, a_coefs,
                 flags.GetStringListFlag("fieldnames" ),
                 flags.GetStringFlag("filename","output"),
                 (int) flags.GetNumFlag("subdivision", 0),
                 (int) flags.GetNumFlag("only_element", -1),
                 flags.GetDefineFlag("nocache"))
 {;}
Exemplo n.º 2
0
  NumProcLinearHyperbolic (shared_ptr<PDE> apde, const Flags & flags)
    : NumProc (apde), 
      timer_element("convection - time element"), 
      timer_facet("convection - time facet"),
      timer_mass("convection - time mass")
  {
    gfu = apde->GetGridFunction (flags.GetStringFlag ("gridfunction", "u"));
    cfflow = apde->GetCoefficientFunction (flags.GetStringFlag ("flow", "flow"));

    dt = flags.GetNumFlag ("dt", 0.001);
    tend = flags.GetNumFlag ("tend", 1);
  }
Exemplo n.º 3
0
NumProcEnergyCalc :: NumProcEnergyCalc (PDE & apde, const Flags & flags)
: NumProc (apde), point(1)
{
	bfa = pde.GetBilinearForm (flags.GetStringFlag ("bilinearform", ""), 1); 
    lff = pde.GetLinearForm (flags.GetStringFlag ("linearform", ""), 1);
    gfu  = pde.GetGridFunction (flags.GetStringFlag ("gridfunction", ""), 0);
    gfu0 = pde.GetGridFunction (flags.GetStringFlag ("gridfunction0", ""), 0);
    gfv = pde.GetGridFunction (flags.GetStringFlag ("gridfunction2", ""), 1); 
    pqrfile = flags.GetStringFlag ("pqrfile","pqr");
    showsteps = flags.GetStringFlag (flags.GetStringFlag ("showsteps", ""), 0);

    readMolecule();

    variablename = flags.GetStringFlag ("resultvariable", "");
    
    point.SetSize(3);

    if (flags.NumListFlagDefined ("point"))
    {
    	const Array<double> & p = flags.GetNumListFlag ("point");
    	point.SetSize(p.Size());
    	for (int i = 0; i < p.Size(); i++)
    		point(i) = p[i];
          
    	cout << "point = " << point << endl;
    }

      
    integrateonplanes = flags.GetDefineFlag("integrateonplanes");

    variabledirection = static_cast<int>(flags.GetNumFlag("variabledirection",0))-1;
    
    n[0] = static_cast<int>(flags.GetNumFlag("n1",0));
    n[1] = static_cast<int>(flags.GetNumFlag("n2",0));
    n[2] = static_cast<int>(flags.GetNumFlag("n3",0));

    text = flags.GetStringFlag ("text","energydiff");

    if(flags.StringFlagDefined("filename"))
      filename = pde.GetDirectory() + dirslash + flags.GetStringFlag("filename","");
    else
      filename = "err.out";

    applyd = flags.GetDefineFlag ("applyd");
    hermitsch = flags.GetDefineFlag ("hermitsch");

    outputprecision = (pde.ConstantUsed("outputprecision")) ? int(pde.GetConstant("outputprecision")) : -1;
    if(flags.NumFlagDefined("outputprecision"))
      outputprecision = int(flags.GetNumFlag("outputprecision",-1));

    component = static_cast<int>(flags.GetNumFlag("cachecomp",1))-1;
}
Exemplo n.º 4
0
void SplineGeometry::LoadData(std::istream& infile)
{
    MESHIT_LOG_INFO("Load 2D Geometry");

    Point2d x;
    char buf[50], ch;

    std::string keyword;
    std::string flag;

    int nb_domains = 0;

    TestComment(infile);
    // refinement factor
    infile >> elto0;

    while (infile.good()) {
        TestComment(infile);
        infile >> keyword;
        ch = TestComment(infile);

        if (keyword == "points") {
            std::vector<GeomPoint> points;
            std::vector<PointIndex> point_ids;
            size_t point_id;
            size_t nb_points = 0;
            while (!isalpha(static_cast<int>(ch))) {
                infile >> point_id;  // point ids are 1-based
                if (point_id > nb_points) nb_points = point_id;
                point_ids.push_back(point_id);

                infile >> x.X() >> x.Y() >> ch;

                Flags flags;
                while (ch == '-') {
                    infile >> flag;
                    flags.SetCommandLineFlag(flag);
                    ch = TestComment(infile);
                }
                infile.unget();
                ch = TestComment(infile);

                points.push_back(GeomPoint(x, flags.GetNumFlag("ref", 1.0), flags.GetNumFlag("maxh", 1e99)));
            }
            geompoints.resize(nb_points);
            for (size_t i = 0; i < nb_points; i++) {
                geompoints[point_ids[i] - 1] = points[i];
            }
        } else if (keyword == "segments") {
Exemplo n.º 5
0
 NumProc :: NumProc (weak_ptr<PDE> apde, const Flags & flags) 
   : NGS_Object (shared_ptr<PDE> (apde)->GetMeshAccess(int(flags.GetNumFlag("mesh",1))-1), "numproc"), 
     pde(apde)
 {
   if (flags.StringFlagDefined ("name"))
     SetName (flags.GetStringFlag ("name",""));
 }
Exemplo n.º 6
0
  HDivDivSurfaceSpace::HDivDivSurfaceSpace(shared_ptr<MeshAccess> ama,
                                           const Flags & aflags, bool parseflags)
    : FESpace(ama, aflags)
  {
    type = "hdivdivsurf";
    order = aflags.GetNumFlag("order", 0);
    DefineNumFlag("discontinuous");
		
    noncontinuous = int(aflags.GetNumFlag("discontinuous", 0));

    // for the dimension ..
    evaluator[VOL] = make_shared<T_DifferentialOperator<DiffOpIdHDivDiv<3>>>();
    // flux_evaluator[VOL] = make_shared<T_DifferentialOperator<DiffOpDivHDivDiv<3>>>();

    evaluator[BND] = make_shared<T_DifferentialOperator<DiffOpIdHDivDivSurface<3>>>();
    auto one = make_shared<ConstantCoefficientFunction>(1);
    // integrator[BND] = make_shared<HDivDivSurfaceMassIntegrator<3>> (one);
    flux_evaluator[BND] =  make_shared<T_DifferentialOperator<DiffOpDivHDivDivSurface<3>>>();
  }
Exemplo n.º 7
0
  L2EnrichedQuadFESpace::L2EnrichedQuadFESpace (shared_ptr<MeshAccess> ama,
				  const Flags & flags)
    : FESpace (ama, flags)   {
    
    _k = int(flags.GetNumFlag ("order", 2));
    evaluator =
      make_shared<T_DifferentialOperator<DiffOpId<2>>>();
    flux_evaluator =
      make_shared<T_DifferentialOperator<DiffOpGradient<2>>>();
    boundary_evaluator =
      make_shared<T_DifferentialOperator<DiffOpIdBoundary<2>>>();
    integrator = GetIntegrators() .
      CreateBFI("mass", ma->GetDimension(), 
		make_shared<ConstantCoefficientFunction>(1));
  }
Exemplo n.º 8
0
  MyHighOrderFESpace :: MyHighOrderFESpace (shared_ptr<MeshAccess> ama, const Flags & flags)
    : FESpace (ama, flags)
  {
    cout << "Constructor of MyHighOrderFESpace" << endl;

    order = int(flags.GetNumFlag ("order", 2));

    // needed to draw solution function
    evaluator = make_shared<T_DifferentialOperator<DiffOpId<2>>>();
    flux_evaluator = make_shared<T_DifferentialOperator<DiffOpGradient<2>>>();
    boundary_evaluator = make_shared<T_DifferentialOperator<DiffOpIdBoundary<2>>>();

    integrator = GetIntegrators().CreateBFI("mass", ma->GetDimension(), 
                                            make_shared<ConstantCoefficientFunction>(1));
  }
Exemplo n.º 9
0
  FESpaceStokes (shared_ptr<MeshAccess> ama, const Flags & flags)
    : CompoundFESpace (ama, flags)
  {
    int order = int (flags.GetNumFlag ("order", 2));
    // if (order < 2)
    // throw Exception ("Taylor-Hood elements need order 2 or higher");

    Flags uflags, pflags;
    uflags.SetFlag ("order", order+1);
    uflags.SetFlag ("orderinner", order+1);
    AddSpace (make_shared<H1HighOrderFESpace> (ma, uflags));
    AddSpace (make_shared<H1HighOrderFESpace> (ma, uflags));
    
    pflags.SetFlag ("order", order);
    AddSpace (make_shared<H1HighOrderFESpace> (ma, pflags));

    // pflags.SetFlag ("order", order-1);
    // AddSpace (make_shared<L2HighOrderFESpace> (ma, pflags));
  }
void SplineGeometry<D> :: LoadDataV2 ( ifstream & infile )
{
  cout << "Load Geometry V2" << endl;
  int nump, numseg, leftdom, rightdom;
  Point<D> x;
  int hi1, hi2, hi3;
  double hd;
  char buf[50], ch;
  int pointnr;

  string keyword;

  ARRAY < GeomPoint<2> > infilepoints (0);
  ARRAY <int> pointnrs (0);
  nump = 0;
  int numdomains = 0;


  TestComment ( infile );
  // refinement factor
  infile >> elto0;
  TestComment ( infile );
      

  // test if next ch is a letter, i.e. new keyword starts
  bool ischar = false;

  while ( infile.good() )
    {
      infile >> keyword;

      ischar = false;

      if ( keyword == "points" )
	{
          cout << "load points" << endl;
	  infile.get(ch);
	  infile.putback(ch);

	  // test if ch is a letter
	  if ( int(ch) >= 65 && int(ch) <=90 )
	    ischar = true;
	  if ( int(ch) >= 97 && int(ch) <= 122 )
	    ischar = true;

	  while ( ! ischar )
	    {
	      TestComment ( infile );
	      infile >> pointnr;
	      // pointnrs 1-based
	      if ( pointnr > nump ) nump = pointnr; 
	      pointnrs.Append(pointnr);
	      
	      for(int j=0; j<D; j++)
		infile >> x(j);
	      // hd is now optional, default 1
	      //  infile >> hd;
	      hd = 1;
	      
	      Flags flags;
	      
	      
	      // get flags, 
	      ch = 'a';
	      // infile >> ch;
	      do 
		{
		  infile.get (ch);
		  // if another int-value, set refinement flag to this value
		  // (corresponding to old files)
		  if ( int (ch) >= 48 && int(ch) <= 57 )
		    {
		      infile.putback(ch);
		      infile >> hd;
		      infile.get(ch);
		    }
		} 
	      while (isspace(ch) && ch != '\n');
	      while (ch == '-')
		{
		  char flag[100];
		  flag[0]='-';
		  infile >> (flag+1);
		  flags.SetCommandLineFlag (flag);
		  ch = 'a';
		  do {
		    infile.get (ch);
		  } while (isspace(ch) && ch != '\n');
		}
	      if (infile.good())
		infile.putback (ch);
	      
	      if ( hd == 1 )
		hd = flags.GetNumFlag ( "ref", 1.0);
	      //       geompoints.Append (GeomPoint<D>(x, hd));

	      infilepoints.Append ( GeomPoint<D>(x, hd) );
	      infilepoints.Last().hpref = flags.GetDefineFlag ("hpref");

	      TestComment(infile);
	      infile.get(ch);
	      infile.putback(ch);

	      // test if letter
	      if ( int(ch) >= 65 && int(ch) <=90 )
		ischar = true;
	      if ( int(ch) >= 97 && int(ch) <= 122 )
		ischar = true;
	    }

	  //	  infile.putback (ch);

	  geompoints.SetSize(nump);
	  for ( int i = 0; i < nump; i++ )
	    {
	      geompoints[pointnrs[i] - 1] = infilepoints[i];
	      geompoints[pointnrs[i] - 1].hpref = infilepoints[i].hpref; 
	    }
	  TestComment(infile);
	}

      else if ( keyword == "segments" )