Exemplo n.º 1
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.º 2
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.º 3
0
void SplineGeometry2d :: LoadData ( ifstream & infile )
{
    enum { D = 2 };

    int nump, numseg, leftdom, rightdom;
    Point<D> x;
    int hi1, hi2, hi3;
    double hd;
    char buf[50], ch;

    materials.SetSize(0);
    maxh.SetSize(0);
    infile >> elto0;

    TestComment ( infile );

    infile >> nump;
    for (int i = 0; i < nump; i++)
    {
        TestComment ( infile );
        for(int j=0; j<D; j++)
            infile >> x(j);
        infile >> hd;

        Flags flags;

        ch = 'a';
        // infile >> ch;
        do {
            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);

        geompoints.Append (GeomPoint<D>(x, hd));
        geompoints.Last().hpref = flags.GetDefineFlag ("hpref");
        geompoints.Last().hmax = 1e99;
    }

//    PrintMessage (3, nump, " points loaded");
    TestComment ( infile );

    infile >> numseg;
    bcnames.SetSize(numseg);
    for ( int i = 0; i < numseg; i++ )
        bcnames[i] = 0; // "default";

    SplineSeg<D> * spline = 0;

//    PrintMessage (3, numseg, " segments loaded");
    for (int i = 0; i < numseg; i++)
    {
        TestComment ( infile );

        infile >> leftdom >> rightdom;

        infile >> buf;
        // type of spline segement
        if (strcmp (buf, "2") == 0)
        {   // a line
            infile >> hi1 >> hi2;
            spline = new LineSeg<D>(geompoints[hi1-1],
                                    geompoints[hi2-1]);
        }
        else if (strcmp (buf, "3") == 0)
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" )