当前位置: 首页>>代码示例>>C++>>正文


C++ TEST_EQUALITY函数代码示例

本文整理汇总了C++中TEST_EQUALITY函数的典型用法代码示例。如果您正苦于以下问题:C++ TEST_EQUALITY函数的具体用法?C++ TEST_EQUALITY怎么用?C++ TEST_EQUALITY使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TEST_EQUALITY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TEUCHOS_UNIT_TEST

TEUCHOS_UNIT_TEST( Rythmos_HermiteInterpolator, interpolate ) {
  RCP<InterpolatorBase<double> > hi = hermiteInterpolator<double>();
  double maxOrder = hi->order();
  for (int order = 0 ; order <= maxOrder+1 ; ++order) {
    TEST_EQUALITY( order, order );
    Polynomial<double> p(order,1.0); 
    RCP<DataStore<double>::DataStoreVector_t> data_in = rcp( new DataStore<double>::DataStoreVector_t );
    double T0 = 0.0;
    double T1 = 1.0;
    int N = 5;
    for (int i=0 ; i < N ; ++i) {
      double t = ((T1-T0)/(N-1.0))*i+T0;
      double x = 0.0;
      double xdot = 0.0;
      p.evaluate(t,&x,&xdot);
      RCP<Thyra::VectorBase<double> > xv, xvdot;
      double accuracy = 0.0;
      xv = createDefaultVector<double>(1,x);
      xvdot = createDefaultVector<double>(1,xdot);
      data_in->push_back(DataStore<double>(t,xv,xvdot,accuracy));
    }
    Array<double> t_values;
    DataStore<double>::DataStoreVector_t data_out;
    N = 2*N;
    for (int i=0 ; i < N ; ++i) {
      double t = ((T1-T0)/(N-1.0))*i+T0;
      t_values.push_back(t);
    }
    interpolate<double>(*hi, data_in, t_values, &data_out);
    // Verify that the interpolated values are exactly the same as the polynomial values
    // unless the order of polynomial is greater than the order of the interpolator
    unsigned int N_out = data_out.size();
    for (unsigned int i=0 ; i < N_out ; ++i ) {
      double x = 0.0;
      double xdot = 0.0;
      double t = data_out[i].time;
      RCP<const Thyra::VectorBase<double> > xv = data_out[i].x;
      RCP<const Thyra::VectorBase<double> > xvdot = data_out[i].xdot;
      {
        Thyra::ConstDetachedVectorView<double> xv_view(*xv);
        x = xv_view[0];
        Thyra::ConstDetachedVectorView<double> xvdot_view(*xvdot);
        xdot = xvdot_view[0];
      }
      double x_exact = 0.0;
      double xdot_exact = 0.0;
      p.evaluate(t,&x_exact,&xdot_exact);
      double tol = 1.0e-15;
      if ((order <= maxOrder) || (i == 0) || (i == N_out-1)) {
        TEST_FLOATING_EQUALITY( x, x_exact, tol );
        TEST_FLOATING_EQUALITY( xdot, xdot_exact, tol );
      } else {
        TEST_COMPARE( fabs((x-x_exact)/x_exact), >, tol );
        TEST_COMPARE( fabs((xdot-xdot_exact)/xdot_exact), >, tol );
      }
    }
  }
}
开发者ID:00liujj,项目名称:trilinos,代码行数:58,代码来源:Rythmos_HermiteInterpolator_UnitTest.cpp

示例2: TEUCHOS_UNIT_TEST

//---------------------------------------------------------------------------//
TEUCHOS_UNIT_TEST( EpetraPointJacobiPreconditioner, tridiag_matrix )
{
    typedef Epetra_RowMatrix MatrixType;
    typedef Epetra_Vector VectorType;
    typedef MCLS::VectorTraits<VectorType> VT;
    typedef MCLS::MatrixTraits<VectorType,MatrixType> MT;

    Teuchos::RCP<const Teuchos::Comm<int> > comm = 
	Teuchos::DefaultComm<int>::getComm();
    Teuchos::RCP<Epetra_Comm> epetra_comm = getEpetraComm( comm );
    int comm_size = comm->getSize();

    int local_num_rows = 10;
    int global_num_rows = local_num_rows*comm_size;
    Teuchos::RCP<Epetra_Map> map = Teuchos::rcp(
	new Epetra_Map( global_num_rows, 0, *epetra_comm ) );

    Teuchos::RCP<Epetra_CrsMatrix> A = 
	Teuchos::rcp( new Epetra_CrsMatrix( Copy, *map, 0 ) );

    Teuchos::Array<int> global_columns( 3 );
    double diag_val = 2.0;
    Teuchos::Array<double> values( 3, diag_val );
    for ( int i = 1; i < global_num_rows-1; ++i )
    {
	global_columns[0] = i-1;
	global_columns[1] = i;
	global_columns[2] = i+1;
	A->InsertGlobalValues( i, global_columns().size(), 
			       &values[0], &global_columns[0] );
    }
    Teuchos::Array<int> single_col(1,0);
    Teuchos::Array<double> diag_elem(1,diag_val);
    A->InsertGlobalValues( 0, 1, diag_elem.getRawPtr(), single_col.getRawPtr() );
    single_col[0] = global_num_rows-1;
    A->InsertGlobalValues( global_num_rows-1, 1, diag_elem.getRawPtr(), 
			   single_col.getRawPtr() );
    A->FillComplete();

    // Build the preconditioner.
    Teuchos::RCP<MCLS::Preconditioner<MatrixType> > preconditioner = 
	Teuchos::rcp( new MCLS::EpetraPointJacobiPreconditioner() );
    preconditioner->setOperator( A );
    preconditioner->buildPreconditioner();
    Teuchos::RCP<const MatrixType> M = preconditioner->getLeftPreconditioner();

    // Check the preconditioner.
    Teuchos::RCP<VectorType> X = MT::cloneVectorFromMatrixRows(*A);
    MT::getLocalDiagCopy( *M, *X );
    Teuchos::ArrayRCP<const double> X_view = VT::view( *X );
    Teuchos::ArrayRCP<const double>::const_iterator view_iterator;
    for ( view_iterator = X_view.begin();
	  view_iterator != X_view.end();
	  ++view_iterator )
    {
	TEST_EQUALITY( *view_iterator, 1.0/diag_val );
    }
}
开发者ID:sslattery,项目名称:MCLS,代码行数:59,代码来源:tstEpetraPointJacobiPreconditioner.cpp

示例3: TEUCHOS_UNIT_TEST

  TEUCHOS_UNIT_TEST(integration_values, volume)
  {
    PHX::KokkosDeviceSession session;
    
    Teuchos::RCP<shards::CellTopology> topo = 
       Teuchos::rcp(new shards::CellTopology(shards::getCellTopologyData< shards::Quadrilateral<4> >()));

    const int num_cells = 20;
    const int base_cell_dimension = 2;
    const panzer::CellData cell_data(num_cells,topo);

    const int cubature_degree = 2;    
    RCP<IntegrationRule> int_rule = 
      rcp(new IntegrationRule(cubature_degree, cell_data));
    
    panzer::IntegrationValues2<double> int_values("prefix_",true);
    panzer::MDFieldArrayFactory af("prefix_",true);

    int_values.setupArrays(int_rule);

    const int num_vertices = int_rule->topology->getNodeCount();
    PHX::MDField<double,Cell,NODE,Dim> node_coordinates 
        = af.buildStaticArray<double,Cell,NODE,Dim>("nc",num_cells, num_vertices, base_cell_dimension);

    // Set up node coordinates.  Here we assume the following
    // ordering.  This needs to be consistent with shards topology,
    // otherwise we will get negative determinates

    // 3(0,1)---2(1,1)
    //   |    0  |
    //   |       |
    // 0(0,0)---1(1,0)

    typedef panzer::ArrayTraits<double,PHX::MDField<double> >::size_type size_type;
    const size_type x = 0;
    const size_type y = 1;
    for (size_type cell = 0; cell < node_coordinates.dimension(0); ++cell) {
      node_coordinates(cell,0,x) = 0.0;
      node_coordinates(cell,0,y) = 0.0;
      node_coordinates(cell,1,x) = 1.0;
      node_coordinates(cell,1,y) = 0.0;
      node_coordinates(cell,2,x) = 1.0;
      node_coordinates(cell,2,y) = 1.0;
      node_coordinates(cell,3,x) = 0.0;
      node_coordinates(cell,3,y) = 1.0;
    }

    int_values.evaluateValues(node_coordinates);
    
    TEST_EQUALITY(int_values.ip_coordinates.dimension(1), 4);
    double realspace_x_coord = (1.0/std::sqrt(3.0) + 1.0) / 2.0;
    double realspace_y_coord = (1.0/std::sqrt(3.0) + 1.0) / 2.0;
    TEST_FLOATING_EQUALITY(int_values.ip_coordinates(0,0,0), 
                           realspace_x_coord, 1.0e-8);
    TEST_FLOATING_EQUALITY(int_values.ip_coordinates(0,0,1), 
                           realspace_y_coord, 1.0e-8);

  }
开发者ID:Russell-Jones-OxPhys,项目名称:Trilinos,代码行数:58,代码来源:integration_values2.cpp

示例4: TEUCHOS_UNIT_TEST

//---------------------------------------------------------------------------//
TEUCHOS_UNIT_TEST( BuhmannBasis, buhmann_basis )
{
    typedef DataTransferKit::BuhmannBasis<3> BasisType;
    typedef DataTransferKit::RadialBasisPolicy<BasisType> BP;

    int dim = 3;

    Teuchos::Array<double> x1(dim, 0.5);
    Teuchos::Array<double> x2(dim, 0.75);

    double radius_1 = 1.0;
    Teuchos::RCP<BasisType> basis_1 = BP::create( radius_1 );

    double dist = DataTransferKit::EuclideanDistance<3>::distance( 
	x1.getRawPtr(), x2.getRawPtr() );
    double basis_value = BP::evaluateValue( *basis_1, dist );
    double basis_grad = BP::evaluateGradient( *basis_1, dist );

    double x = 0.0;
    for ( int i = 0; i < dim; ++i )
    {
	x += (x2[i]-x1[i])*(x2[i]-x1[i]);
    }
    x = std::sqrt(x);
    double test_value = x*x*x*x*x*x*x*x - 84.0/5.0*x*x*x*x*x*x +
			1024.0/5.0*x*std::sqrt(x*x*x*x*x*x*x) -
			378.0*x*x*x*x + 1024.0/5.0*std::sqrt(x*x*x*x*x*x*x) -
			84.0/5.0*x*x + 1.0;
    double test_grad = (8.0/5.0) * 
		       (576.0*x*std::sqrt(x*x*x*x*x) + 
			448.0*std::sqrt(x*x*x*x*x) + 5.0*x*x*x*x*x*x*x -
			63.0*x*x*x*x*x - 945.0*x*x*x - 21.0*x);

    TEST_EQUALITY( test_value, basis_value );
    TEST_EQUALITY( test_grad, basis_grad );

    double radius_2 = 0.1;
    BasisType basis_2( radius_2 );

    basis_value = BP::evaluateValue( basis_2, dist );
    basis_grad = BP::evaluateGradient( basis_2, dist );

    TEST_EQUALITY( 0.0, basis_value );
    TEST_EQUALITY( 0.0, basis_grad );
}
开发者ID:amccaskey,项目名称:DataTransferKit,代码行数:46,代码来源:tstRadialBasis.cpp

示例5: TEUCHOS_UNIT_TEST

//---------------------------------------------------------------------------//
// Tests.
//---------------------------------------------------------------------------//
TEUCHOS_UNIT_TEST( NanoflannTree, dim_1_test )
{
    int dim = 1;
    int num_points = 10;
    int num_coords = dim*num_points;

    Teuchos::Array<double> coords(num_coords);
    for ( int i = 0; i < num_points; ++i )
    {
        coords[i] = 1.0*i;
    }

    int max_leaf_size = 3;
    DataTransferKit::NanoflannTree<1> tree( coords(), max_leaf_size );

    Teuchos::Array<double> p1( dim );
    p1[0] = 4.9;
    Teuchos::Array<double> p2( dim );
    p2[0] = 11.4;

    int num_neighbors = 1;
    Teuchos::Array<unsigned> nnearest =
        tree.nnSearch( p1(), num_neighbors );
    TEST_EQUALITY( num_neighbors, nnearest.size() );
    TEST_EQUALITY( 5, nnearest[0] );

    nnearest = tree.nnSearch( p2(), num_neighbors );
    TEST_EQUALITY( num_neighbors, nnearest.size() );
    TEST_EQUALITY( 9, nnearest[0] );

    double radius = 1.1;
    nnearest = tree.radiusSearch( p1(), radius );
    TEST_EQUALITY( 3, nnearest.size() );
    TEST_EQUALITY( 5, nnearest[0] )
    TEST_EQUALITY( 4, nnearest[1] )
    TEST_EQUALITY( 6, nnearest[2] )

    nnearest = tree.radiusSearch( p2(), radius );
    TEST_EQUALITY( 0, nnearest.size() );

    radius = 2.41;
    nnearest = tree.radiusSearch( p2(), radius );
    TEST_EQUALITY( 1, nnearest.size() );
    TEST_EQUALITY( 9, nnearest[0] )
}
开发者ID:amccaskey,项目名称:DataTransferKit,代码行数:48,代码来源:tstStaticSearchTree.cpp

示例6: TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL

//---------------------------------------------------------------------------//
TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( ForwardHistory, broadcast, Ordinal )
{
    Teuchos::RCP<const Teuchos::Comm<int> > comm = 
	Teuchos::DefaultComm<int>::getComm();
    int comm_rank = comm->getRank();

    MCLS::ForwardHistory<Ordinal>::setByteSize();
    std::size_t packed_bytes =
	MCLS::ForwardHistory<Ordinal>::getPackedBytes();
    Teuchos::Array<char> packed_history( packed_bytes );

    if ( comm_rank == 0 )
    {
	MCLS::ForwardHistory<Ordinal> h_1( 5, 2, 6 );
	h_1.live();
	h_1.setEvent( MCLS::Event::BOUNDARY );
	h_1.addToHistoryTally( 1.98 );
	h_1.addStep();
	packed_history = h_1.pack();
    }

    Teuchos::broadcast( *comm, 0, packed_history() );

    MCLS::ForwardHistory<Ordinal> h_2( packed_history );
    TEST_EQUALITY( h_2.weight(), 6 );
    TEST_EQUALITY( h_2.globalState(), 5 );
    TEST_EQUALITY( h_2.localState(), Teuchos::OrdinalTraits<Ordinal>::invalid() );
    TEST_EQUALITY( h_2.startingState(), 5 );
    TEST_ASSERT( h_2.alive() );
    TEST_EQUALITY( h_2.event(), MCLS::Event::BOUNDARY );
    TEST_EQUALITY( h_2.historyTally(), 1.98 );
    TEST_EQUALITY( h_2.numSteps(), 1 );
}
开发者ID:sslattery,项目名称:MCLS,代码行数:34,代码来源:tstForwardHistory.cpp

示例7: TEUCHOS_UNIT_TEST_TEMPLATE_4_DECL

  TEUCHOS_UNIT_TEST_TEMPLATE_4_DECL(ThresholdAFilterFactory, Basic, Scalar, LocalOrdinal, GlobalOrdinal, Node)
  {
#   include <MueLu_UseShortNames.hpp>
    MUELU_TESTING_SET_OSTREAM;
    MUELU_TESTING_LIMIT_EPETRA_SCOPE(Scalar,GlobalOrdinal,Node);
    out << "version: " << MueLu::Version() << std::endl;

    Level aLevel;
    TestHelpers::TestFactory<SC, LO, GO, NO>::createSingleLevelHierarchy(aLevel);

    RCP<Matrix> A = TestHelpers::TestFactory<SC, LO, GO, NO>::Build1DPoisson(20); //can be an empty operator

    RCP<ThresholdAFilterFactory> AfilterFactory0 = rcp(new ThresholdAFilterFactory("A",0.1)); // keep all
    RCP<ThresholdAFilterFactory> AfilterFactory1 = rcp(new ThresholdAFilterFactory("A",1.1)); // keep only diagonal
    RCP<ThresholdAFilterFactory> AfilterFactory2 = rcp(new ThresholdAFilterFactory("A",3));   // keep only diagonal

    aLevel.Set("A",A);

    aLevel.Request("A",AfilterFactory0.get());
    AfilterFactory0->Build(aLevel);
    TEST_EQUALITY(aLevel.IsAvailable("A",AfilterFactory0.get()), true);
    RCP<Matrix> A0 = aLevel.Get< RCP<Matrix> >("A",AfilterFactory0.get());
    aLevel.Release("A",AfilterFactory0.get());
    TEST_EQUALITY(aLevel.IsAvailable("A",AfilterFactory0.get()), false);
    TEST_EQUALITY(A0->getNodeNumEntries(), A->getNodeNumEntries());
    TEST_EQUALITY(A0->getGlobalNumEntries(), A->getGlobalNumEntries());

    aLevel.Request("A",AfilterFactory1.get());
    AfilterFactory1->Build(aLevel);
    TEST_EQUALITY(aLevel.IsAvailable("A",AfilterFactory1.get()), true);
    RCP<Matrix> A1 = aLevel.Get< RCP<Matrix> >("A",AfilterFactory1.get());
    aLevel.Release("A",AfilterFactory1.get());
    TEST_EQUALITY(aLevel.IsAvailable("A",AfilterFactory1.get()), false);
    TEST_EQUALITY(A1->getGlobalNumEntries(), A1->getGlobalNumRows());

    aLevel.Request("A",AfilterFactory2.get());
    AfilterFactory2->Build(aLevel);
    TEST_EQUALITY(aLevel.IsAvailable("A",AfilterFactory2.get()), true);
    RCP<Matrix> A2 = aLevel.Get< RCP<Matrix> >("A",AfilterFactory2.get());
    aLevel.Release("A",AfilterFactory2.get());
    TEST_EQUALITY(aLevel.IsAvailable("A",AfilterFactory2.get()), false);
    TEST_EQUALITY(A2->getGlobalNumEntries(), A2->getGlobalNumRows());


  }
开发者ID:jdbooth,项目名称:Trilinos,代码行数:45,代码来源:ThresholdAFilterFactory.cpp

示例8: TEUCHOS_UNIT_TEST

  TEUCHOS_UNIT_TEST(physics_block, physicsBlockID)
  {
    PHX::KokkosDeviceSession session;

    Teuchos::RCP<panzer::PhysicsBlock> physics_block = 
      panzer_test_utils::createPhysicsBlock();

    TEST_EQUALITY(physics_block->physicsBlockID(), "4");
  }
开发者ID:Russell-Jones-OxPhys,项目名称:Trilinos,代码行数:9,代码来源:physics_block.cpp

示例9: TEUCHOS_UNIT_TEST

TEUCHOS_UNIT_TEST(Teuchos_TwoDArrays, streamTests){
  TwoDArray<int> simpleArray = getSimpleTestTwoDArray();
  std::stringstream ss;
  ss << simpleArray;
  TwoDArray<int> readArray;
  std::istringstream instream(ss.str()); 
  instream >> readArray;
  TEST_EQUALITY(simpleArray, readArray);
}
开发者ID:00liujj,项目名称:trilinos,代码行数:9,代码来源:TwoDArray_UnitTests.cpp

示例10: TEUCHOS_UNIT_TEST

  TEUCHOS_UNIT_TEST(SaPFactory, Test0)
  {
    out << "version: " << MueLu::Version() << std::endl;

    RCP<SaPFactory> sapFactory = rcp(new SaPFactory);
    TEST_EQUALITY(sapFactory != Teuchos::null, true);

    out << *sapFactory << std::endl;

  }
开发者ID:bartlettroscoe,项目名称:Trilinos,代码行数:10,代码来源:SaPFactory.cpp

示例11: TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL

TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( SpmdLocalDataAccess,
  zeroVS, Scalar )
{
  out << "Create a locally replicated vector space ...\n";
  typedef typename ScalarTraits<Scalar>::magnitudeType ScalarMag;
  const RCP<const DefaultSpmdVectorSpace<Scalar> > vs =
    createZeroVS<Scalar>();
  TEST_ASSERT(!vs->isLocallyReplicated());
  TEST_EQUALITY_CONST(vs->dim(), 0);
  const RCP<const Teuchos::Comm<Ordinal> > comm = vs->getComm();
  const Scalar val = as<Scalar>(1.5);
  PRINT_VAR(val);

  out << "Test locally replicated Vector ...\n";
  const RCP<VectorBase<Scalar> > v = createMember<Scalar>(vs);
  {
    ECHO(RTOpPack::SubVectorView<Scalar> lsv = 
      getNonconstLocalSubVectorView<Scalar>(v));
    TEST_EQUALITY_CONST(lsv.globalOffset(), 0);
    TEST_EQUALITY(lsv.subDim(), 0);
    TEST_EQUALITY_CONST(lsv.stride(), 1);
  }
  {
    ECHO(RTOpPack::ConstSubVectorView<Scalar> lsv = 
      getLocalSubVectorView<Scalar>(v));
    TEST_EQUALITY_CONST(lsv.globalOffset(), 0);
    TEST_EQUALITY(lsv.subDim(), 0);
    TEST_EQUALITY_CONST(lsv.stride(), 1);
  }
  assign<Scalar>(v.ptr(), val);
  TEST_EQUALITY(sum<Scalar>(*v), as<Scalar>(0.0));
  
  out << "Test locally replicated MultiVector ...\n";
  const RCP<MultiVectorBase<Scalar> > mv = createMembers<Scalar>(vs, g_numCols);
  {
    ECHO(RTOpPack::SubMultiVectorView<Scalar> lsmv = 
      getNonconstLocalSubMultiVectorView<Scalar>(mv));
    TEST_EQUALITY(lsmv.globalOffset(), 0);
    TEST_EQUALITY(lsmv.subDim(), 0);
    TEST_EQUALITY(lsmv.leadingDim(), lsmv.subDim());
    TEST_EQUALITY_CONST(lsmv.colOffset(), 0);
    TEST_EQUALITY(lsmv.numSubCols(), g_numCols);
  }
  {
    ECHO(RTOpPack::ConstSubMultiVectorView<Scalar> lsmv = 
      getLocalSubMultiVectorView<Scalar>(mv));
  }
  assign<Scalar>(mv.ptr(), val);
  for (int j = 0; j < g_numCols; ++j) {
    TEST_EQUALITY(sum<Scalar>(*mv->col(0)), as<Scalar>(0.0));
  }
  
}
开发者ID:00liujj,项目名称:trilinos,代码行数:53,代码来源:SpmdLocalDataAccess_UnitTests.cpp

示例12: TEUCHOS_UNIT_TEST

  /* This test is to make sure that stratimikos wrappers to belos
     correctly catch belos exceptions thrown and report back a failed
     solve.  If belos detects a nan in the linear solve, it will throw
     an exception.  This was causing the termination of the
     simulation.  We have codes where cutting the time step allows
     recovery so it makes sense that stratimikos should catch the
     thrown exception and report that the solve failed.  Then the time
     integrator can retake a time step.  This test makes sure the
     stratimikos interface catches the exception and reports a failed
     solve.
  */
  TEUCHOS_UNIT_TEST(belos, nan_handling)
  {
    
    Epetra_SerialComm comm;
    Teuchos::RCP<Epetra_CrsMatrix> epetra_A;
    std::string matrixFile = "FourByFour.mtx";
    EpetraExt::readEpetraLinearSystem( matrixFile, comm, &epetra_A );

    Teuchos::RCP<const LinearOpBase<double> > A = epetraLinearOp(epetra_A);

    Teuchos::RCP<LinearOpWithSolveFactoryBase<double> >
      lowsFactory;
    {
      Teuchos::RCP<BelosLinearOpWithSolveFactory<double> >
        belosLowsFactory = Teuchos::rcp(new BelosLinearOpWithSolveFactory<double>());
      lowsFactory = belosLowsFactory;
    }

    Teuchos::ParameterList belosLOWSFPL;
    {
      belosLOWSFPL.set("Solver Type","Block GMRES");

      Teuchos::ParameterList& belosLOWSFPL_solver =
	belosLOWSFPL.sublist("Solver Types");
      
      Teuchos::ParameterList& belosLOWSFPL_gmres =
	belosLOWSFPL_solver.sublist("Block GMRES");
      
      belosLOWSFPL_gmres.set("Maximum Iterations",int(4));
      belosLOWSFPL_gmres.set("Convergence Tolerance",double(1.0e-4));
      belosLOWSFPL_gmres.set("Maximum Restarts",int(0));
      belosLOWSFPL_gmres.set("Block Size",int(1));
      belosLOWSFPL_gmres.set("Num Blocks",int(4));
      belosLOWSFPL_gmres.set("Output Frequency",int(1));
      belosLOWSFPL_gmres.set("Show Maximum Residual Norm Only",bool(false));
      
      lowsFactory->setParameterList(Teuchos::rcp(&belosLOWSFPL,false));
    }

    Teuchos::RCP<LinearOpWithSolveBase<double> > nsA = lowsFactory->createOp();
    Thyra::initializeOp<double>(*lowsFactory,  A, nsA.ptr());

    Teuchos::RCP<Thyra::VectorBase<double> > x = Thyra::createMember(A->domain());
    Teuchos::RCP<Thyra::VectorBase<double> > f = Thyra::createMember(A->range());

    Thyra::put_scalar(0.0,x.ptr());
    Thyra::put_scalar(1.0,f.ptr());
    
    // Insert a nan
    Thyra::set_ele(0,Teuchos::ScalarTraits<double>::nan(),x.ptr());

    Thyra::SolveStatus<double> status = Thyra::solve<double>(*nsA,Thyra::NOTRANS,*f,x.ptr());

    TEST_EQUALITY(status.solveStatus, Thyra::SOLVE_STATUS_UNCONVERGED);
  }
开发者ID:00liujj,项目名称:trilinos,代码行数:66,代码来源:test_stratimikos_belos_nan_handler.cpp

示例13: TEUCHOS_UNIT_TEST

  TEUCHOS_UNIT_TEST(TransPFactory, Constructor)
  {

    out << "version: " << MueLu::Version() << std::endl;

    RCP<TransPFactory> transPFact = rcp(new TransPFactory);
    TEST_EQUALITY(transPFact != Teuchos::null, true);

    out << *transPFact << std::endl;

  }
开发者ID:00liujj,项目名称:trilinos,代码行数:11,代码来源:TransPFactory.cpp

示例14: TEUCHOS_UNIT_TEST

TEUCHOS_UNIT_TEST(tOrientation, testFaceBasis_tri2)
{

   out << note << std::endl;

   shards::CellTopology tri(shards::getCellTopologyData<shards::Triangle<3> >());

   // basis to build patterns from
   RCP<Intrepid2::Basis<PHX::exec_space,double,double> > basisA = rcp(new Intrepid2::Basis_Constant_FEM<PHX::exec_space,double,double>(tri));

   RCP<const FieldPattern> patternA = rcp(new Intrepid2FieldPattern(basisA));

   TEST_EQUALITY(patternA->numberIds(),1);

   std::vector<std::vector<int> > topFaceIndices;
   orientation_helpers::computePatternFaceIndices(*patternA,topFaceIndices);

   TEST_EQUALITY(topFaceIndices.size(),1);
   TEST_EQUALITY(topFaceIndices[0].size(),3); TEST_EQUALITY(topFaceIndices[0][0],0); TEST_EQUALITY(topFaceIndices[0][1],1); TEST_EQUALITY(topFaceIndices[0][2],2);
}
开发者ID:trilinos,项目名称:Trilinos,代码行数:20,代码来源:tOrientations.cpp

示例15: TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL

//---------------------------------------------------------------------------//
// Tests.
//---------------------------------------------------------------------------//
TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( HistoryBuffer, sizes, Ordinal )
{
    typedef MCLS::AdjointHistory<Ordinal> HT;

    MCLS::HistoryBuffer<HT> buffer_1;
    TEST_EQUALITY( buffer_1.allocatedSize(), 0 );
    TEST_ASSERT( buffer_1.isEmpty() );
    TEST_ASSERT( !buffer_1.isFull() );

    TEST_EQUALITY( MCLS::HistoryBuffer<HT>::maxNum(), 1000 );
    TEST_EQUALITY( MCLS::HistoryBuffer<HT>::sizePackedHistory(), 0 );

    HT::setByteSize();
    MCLS::HistoryBuffer<HT>::setSizePackedHistory( HT::getPackedBytes() );
    MCLS::HistoryBuffer<HT>::setMaxNumHistories( 10 );
    TEST_EQUALITY( MCLS::HistoryBuffer<HT>::maxNum(), 10 );
    TEST_EQUALITY( MCLS::HistoryBuffer<HT>::sizePackedHistory(),
		   sizeof(double)+sizeof(Ordinal)+3*sizeof(int) );

    MCLS::HistoryBuffer<HT> buffer_2;
    TEST_EQUALITY( buffer_2.allocatedSize(), 0 );
    TEST_ASSERT( buffer_2.isEmpty() );
    TEST_ASSERT( !buffer_2.isFull() );

    buffer_2.allocate();

    TEST_EQUALITY( buffer_2.allocatedSize(),
		   10 * MCLS::HistoryBuffer<HT>::sizePackedHistory()
		   + sizeof(int) );
    TEST_ASSERT( buffer_2.isEmpty() );
    TEST_ASSERT( !buffer_2.isFull() );

    buffer_2.deallocate();
    TEST_EQUALITY( buffer_2.allocatedSize(), 0 );
    TEST_ASSERT( buffer_2.isEmpty() );
    TEST_ASSERT( !buffer_2.isFull() );

    TEST_EQUALITY( MCLS::HistoryBuffer<HT>::maxNum(), 10 );
    TEST_EQUALITY( MCLS::HistoryBuffer<HT>::sizePackedHistory(),
		   sizeof(double) + sizeof(Ordinal) + 3*sizeof(int));
}
开发者ID:sslattery,项目名称:MCLS,代码行数:44,代码来源:tstHistoryBuffer.cpp


注:本文中的TEST_EQUALITY函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。