Esempio n. 1
0
 printf(":%s:\n",ptr);
 free(ptr);

 ptr=Replicate("HERVE","12","\0");
 printf("Replicate:%s:\n",ptr);
 free(ptr);

 ptr=Replicate("HERVE","0","\0");
 printf("Replicate=0:%s:\n",ptr);
 free(ptr);
 
 ptr=Replicate("","14","\0");
 printf("Replicate=14 chaine vide:%s:\n",ptr);
 free(ptr);

 ptr=ZeroSpace(" AA  BB      CCC    dD EEFFFF GG ","\0");
 printf("ZeroSpace:%s:\n",ptr);
 free(ptr);

 ptr=ZeroSpace(" ","\0");
 printf(":%s:\n",ptr);
 free(ptr);

 ptr=ZeroSpace("","\0");
 printf(":%s:\n",ptr);
 free(ptr);
 
 ptr=CentrerCh("Essai de texte1","30","\0");
 printf("CentrerCh:%s:\n",ptr);
 free(ptr);
Esempio n. 2
0
int main(int argc, char *argv[]) 
{
#ifdef HAVE_MPI
  MPI_Init(&argc,&argv);
  Tpetra::MpiComm<OrdinalType, ScalarType> Comm(MPI_COMM_WORLD);
#else
  Tpetra::SerialComm<OrdinalType, ScalarType> Comm;
#endif

  // Get zero and one for the OrdinalType
  
  OrdinalType const OrdinalZero = Teuchos::ScalarTraits<OrdinalType>::zero();
  OrdinalType const OrdinalOne  = Teuchos::ScalarTraits<OrdinalType>::one();

  // Get zero and one for the ScalarType
  
  ScalarType const ScalarZero = Teuchos::ScalarTraits<ScalarType>::zero();
  ScalarType const ScalarOne  = Teuchos::ScalarTraits<ScalarType>::one();

  // Creates a vector of size `length', then set the elements values.
  
  OrdinalType length    = OrdinalOne * 2 * Comm.getNumImages();
  OrdinalType indexBase = OrdinalZero;

  // 1) Creation of a platform
  
#ifdef HAVE_MPI
  const Tpetra::MpiPlatform <OrdinalType, OrdinalType> platformE(MPI_COMM_WORLD);
  const Tpetra::MpiPlatform <OrdinalType, ScalarType> platformV(MPI_COMM_WORLD);
#else
  const Tpetra::SerialPlatform <OrdinalType, OrdinalType> platformE;
  const Tpetra::SerialPlatform <OrdinalType, ScalarType> platformV;
#endif

  // linearly distributed space

  Tpetra::ElementSpace<OrdinalType> LinearSpace(length, indexBase, platformE);
  Tpetra::VectorSpace<OrdinalType, ScalarType> VectorLinearSpace(LinearSpace, platformV);

  // all elements on processor 0

  OrdinalType NumMyElements = (Comm.getMyImageID() == 0)?length:0;
  Tpetra::ElementSpace<OrdinalType> ZeroSpace(-1, NumMyElements, indexBase, platformE);
  Tpetra::VectorSpace<OrdinalType, ScalarType> VectorZeroSpace(ZeroSpace, platformV);

  Tpetra::Vector<OrdinalType, ScalarType> LinearV(VectorLinearSpace);
  Tpetra::Vector<OrdinalType, ScalarType> ZeroV(VectorZeroSpace);

  LinearV.setAllToScalar(Comm.getMyImageID());

  cout << LinearV;

  Tpetra::Import<OrdinalType> Importer(LinearSpace, ZeroSpace);

  ZeroV.doImport(LinearV, Importer, Tpetra::Insert);

  cout << ZeroV;

#ifdef HAVE_MPI
  MPI_Finalize() ;
#endif

  return(EXIT_SUCCESS);
}