Exemplo n.º 1
0
int main()
{
  const Point<2> p1(0.0, 0.0), p2(1.0, 1.0);
  dealii::Triangulation<2> triangulation;
  dealii::GridGenerator::hyper_rectangle(triangulation, p1, p2);
  triangulation.refine_global(num_levels);

  const F<2> f;
  const G<2> g;

  // Create a TensorFunction from two scalar Functions
  const auto psi = internal::TensorFunctionFromScalarFunctions<2>(f, g);

  // Generate a bunch of random poins in the unit square
  std::random_device device;
  std::mt19937 rng;
  rng.seed(device());
  std::uniform_real_distribution<> u(0, 1);

  const size_t num_points = 32;
  std::vector<Point<2> > points(num_points);
  for (size_t k = 0; k < num_points; ++k) {
    points[k][0] = u(rng);
    points[k][1] = u(rng);
  }

  // Check that the TensorFunction and its coordinate functions agree at a
  // few points
  for (size_t k = 0; k < num_points; ++k) {
    const Point<2>& p = points[k];
    const Tensor<1, 2> v = psi.value(p);
    Tensor<1, 2> w;
    w[0] = f.value(p);
    w[1] = g.value(p);

    check((v - w).norm() < 1.0e-15);
  }

  return 0;
}
Exemplo n.º 2
0
    virtual void licz_tab(int n)
    {
        //cout << "f(" << d << "," << n << ")\n";

        long long wyn = 0;
        if (((n*10) % d) == 0) wyn++;

        for (int i = n*10; i > 0; i -= d) {
            wyn += next->get(i/10);
            //cout << "+" << next->get(i/10) << endl;
        }

        tab[n] = wyn;
    }
Exemplo n.º 3
0
	bool operator() (pair<const F, S> elem)
	{		return ( _stricmp(elem.first.c_str(), string_key.c_str())== 0);		}
Exemplo n.º 4
0

SCENARIO("C/C++ circular queue factory", "[factory]")
{

	typedef gdc::circular_queue_factory<char> F;
	typedef typename F::value_type Q;

	// Remove any stale shared queue.
	F::delete_shared(name);
	
	
	GIVEN("circular_queue_factory to create a shared queue")
	{

		F f(name, 10 * page_size);
		
		
		WHEN("writing to the data area")
		{
			auto& q = f.get();
			auto p = reinterpret_cast<char*>(&q);
			auto data = &p[page_size];
			std::strcpy(data, "blah");
			
			THEN("the data is visible in the 2nd mapped area")
			{
				auto data2 = &data[10 * page_size];
				REQUIRE(std::strncmp(data2, "blah", 5) == 0);
			}
		}
Exemplo n.º 5
0
 options serialize() const override
 {
     return f_.serialize();
 }
Exemplo n.º 6
0
Arquivo: ttp31.C Projeto: 0day-ci/gcc
		int f() { return d.f(); }
Exemplo n.º 7
0
Arquivo: const1.C Projeto: 0day-ci/gcc
 void g4 () { if (g->a > 1) { g->a2 (); g = new F<T> (*g); } }
Exemplo n.º 8
0
Arquivo: const1.C Projeto: 0day-ci/gcc
 D<T> g3 (const T& x) { g4 (); return g->f1 (g1 (), x); }
Exemplo n.º 9
0
Arquivo: const1.C Projeto: 0day-ci/gcc
 G (const G<T>& x) { g = x.g; g->a1 (); }
Exemplo n.º 10
0
			R operator()()
			{
				f_.wait();
				return w_(f_);
			}