Exemple #1
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void TestCrystalStructureTest()
{

  uint32_t chigh = Ebsd::CrystalStructure::Cubic_High;
  uint32_t clow = Ebsd::CrystalStructure::Cubic_Low;

  uint32_t hhigh = Ebsd::CrystalStructure::Hexagonal_High;
  uint32_t hlow = Ebsd::CrystalStructure::Hexagonal_Low;

  bool b = Ebsd::CrystalStructure::Cubic_High == chigh;
  DREAM3D_REQUIRE_EQUAL(b, true)

  b = Ebsd::CrystalStructure::Cubic_High == clow;
  DREAM3D_REQUIRE_EQUAL(b, false)

  b = Ebsd::CrystalStructure::Cubic_High == hlow;
  DREAM3D_REQUIRE_EQUAL(b, false)

  b = Ebsd::CrystalStructure::Hexagonal_High == hhigh;
  DREAM3D_REQUIRE_EQUAL(b, true)

  b = Ebsd::CrystalStructure::Hexagonal_High == hlow;
  DREAM3D_REQUIRE_EQUAL(b, false)

  b = Ebsd::CrystalStructure::Hexagonal_High == clow;
  DREAM3D_REQUIRE_EQUAL(b, false)

}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void ExecutePipeline(const QString& pipelineFile)
{
  int err = EXIT_SUCCESS;

  // Sanity Check the filepath to make sure it exists, Report an error and bail if it does not
  QFileInfo fi(pipelineFile);
  std::cout << "<--------------Test Pipeline File: " << fi.absoluteFilePath().toStdString() << " --------------------------->" << std::endl;
  if(fi.exists() == false)
  {
    std::cout << "The input file '" << pipelineFile.toStdString() << "' does not exist" << std::endl;
    err = EXIT_FAILURE;
  }
  DREAM3D_REQUIRE_EQUAL(err, EXIT_SUCCESS)

  QString ext = fi.completeSuffix();

  // Use the static method to read the Pipeline file and return a Filter Pipeline
  FilterPipeline::Pointer pipeline;
  if (ext == "ini" || ext == "txt")
  {
    pipeline = QFilterParametersReader::ReadPipelineFromFile(pipelineFile, QSettings::IniFormat);
  }
  else if (ext == "dream3d")
  {
    pipeline = H5FilterParametersReader::ReadPipelineFromFile(pipelineFile);
  }
  else if (ext == "json")
  {
    pipeline = JsonFilterParametersReader::ReadPipelineFromFile(pipelineFile);
  }

  if (NULL == pipeline.get())
  {
    std::cout << "An error occurred trying to read the pipeline file. Exiting now." << std::endl;
    err = EXIT_FAILURE;
  }
  DREAM3D_REQUIRE_EQUAL(err, EXIT_SUCCESS)


  Observer obs; // Create an Observer to report errors/progress from the executing pipeline
  pipeline->addMessageReceiver(&obs);
  // Preflight the pipeline
  err = pipeline->preflightPipeline();
  if (err < 0)
  {
    std::cout << "Errors preflighting the pipeline. Exiting Now." << std::endl;
  }
  DREAM3D_REQUIRE_EQUAL(err, EXIT_SUCCESS)

  // Now actually execute the pipeline
  pipeline->execute();
  err = pipeline->getErrorCondition();
  if (err < 0)
  {
    std::cout << "Error Condition of Pipeline: " << err << std::endl;
    err = EXIT_FAILURE;
  }
  DREAM3D_REQUIRE_EQUAL(err, EXIT_SUCCESS)

}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int AbsolutePathTest()
{
    std::cout  << "|- AbsolutePathTest -----------------" << std::endl;
    int err = 0;
    int success = 0;

    std::string testdir = MXAUnitTest::MXATempDir + MXAUnitTest::MXAFileSystemPathTest::TestDir;

    std::string currentPath = MXADir::currentPath();
    std::string refPath = MXAUnitTest::MXATestBinaryDirectory;
    std::cout << "|++ currentPath: " << currentPath << std::endl;
    std::cout << "|++ refPath:     " << refPath << std::endl;
    success = currentPath.compare(refPath);
    DREAM3D_REQUIRE_EQUAL(success, 0);

    std::string file = MXAUnitTest::MXAFileSystemPathTest::OutputFileName;
    PRINT_LINE_NUMBER();
    CheckFile(MXAUnitTest::MXAFileSystemPathTest::OutputFileName, file, "bin");
    file = MXADir::absolutePath(file);
    refPath = MXAUnitTest::MXATestBinaryDirectory + MXADir::Separator + MXAUnitTest::MXAFileSystemPathTest::OutputFileName;
    std::cout << "|-- file:    " << file << std::endl;
    std::cout << "|-- refPath: " << refPath << std::endl;
    success = file.compare(refPath);
    DREAM3D_REQUIRE_EQUAL(success, 0);
    PRINT_LINE_NUMBER();
    CheckFile(  file, MXAUnitTest::MXAFileSystemPathTest::OutputFileName, "bin");

    // Check with a ./ prefixed to the file path
    file = MXAUnitTest::MXAFileSystemPathTest::OutputFileName;
    PRINT_LINE_NUMBER();
    CheckFile("." + MXADir::getSeparator() + MXAUnitTest::MXAFileSystemPathTest::OutputFileName, file, "bin");
    file = MXADir::absolutePath(file);
    refPath = MXAUnitTest::MXATestBinaryDirectory + MXADir::Separator + MXAUnitTest::MXAFileSystemPathTest::OutputFileName;
    std::cout << "|-- file:    " << file << std::endl;
    std::cout << "|-- refPath: " << refPath << std::endl;
    success = file.compare(refPath);
    DREAM3D_REQUIRE_EQUAL(success, 0);
    PRINT_LINE_NUMBER();
    CheckFile(file, MXAUnitTest::MXAFileSystemPathTest::OutputFileName, "bin");

    // Check with a ../ prefixed to the file name
    file = MXAUnitTest::MXAFileSystemPathTest::OutputFileName;
    PRINT_LINE_NUMBER();
    CheckFile( ".." + MXADir::getSeparator() + MXAUnitTest::MXAFileSystemPathTest::OutputFileName, file, "bin");
    file = MXAUnitTest::MXABuildDir + MXADir::Separator + file;
    refPath = MXAUnitTest::MXABuildDir + MXADir::Separator + MXAUnitTest::MXAFileSystemPathTest::OutputFileName;
    std::cout << "|-- file:    " << file << std::endl;
    std::cout << "|-- refPath: " << refPath << std::endl;
    success = file.compare(refPath);
    DREAM3D_REQUIRE_EQUAL(success, 0);
    PRINT_LINE_NUMBER();
    CheckFile(file, MXAUnitTest::MXAFileSystemPathTest::OutputFileName, "bin");


    return err;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void CheckFile(const std::string &filepath,
               const std::string &filename,
               const std::string &extension)
{
    std::cout  << "|-- CheckFile " << filepath << std::endl;
    bool exists;
    bool isDir;
    bool isFile;
    bool ok;
    {
        // Write a file so we can try and delete it
        std::cout << "|--  Create: '" << filepath << "'" << std::endl;
        std::ofstream outStream(filepath.c_str(), std::ios::out | std::ios::binary);
        DREAM3D_REQUIRE_EQUAL(false, outStream.fail() );
        std::string data ( "MXADir_Test Contents");
        outStream.write(data.c_str(), data.length());
        DREAM3D_REQUIRE_EQUAL (outStream.bad(), false);
        outStream.close();
    }


    std::string compName = filename;
    if (compName.at(compName.size()-1) == '.')
    {
        compName = compName.substr(0, compName.size() - 1);
    }

    isDir = MXADir::isDirectory(filepath);
    DREAM3D_REQUIRE_EQUAL(isDir, false);
    isFile = MXADir::isFile(filepath);
    DREAM3D_REQUIRE_EQUAL(isFile, true);
    exists = MXADir::exists(filepath);
    DREAM3D_REQUIRE_EQUAL(exists, true);
    std::string fn = MXAFileInfo::filename(filepath);
    DREAM3D_REQUIRE_EQUAL(fn, compName);
    std::string ext = MXAFileInfo::extension(filepath);
    DREAM3D_REQUIRE_EQUAL(ext, extension);

    // Now try to delete the file
    std::cout << "|--  Delete: '" << filepath << "'" << std::endl;
    ok = MXADir::remove(filepath);
    DREAM3D_REQUIRE_EQUAL(ok, true);
    exists = MXADir::exists(filepath);
    DREAM3D_REQUIRE_EQUAL(exists, false);

    std::cout << "|--  Delete Again:" << std::endl;
    ok = MXADir::remove(filepath);
    DREAM3D_REQUIRE_EQUAL(ok, false);
}
Exemple #5
0
void _TestCopyData()
{
  size_t numTuples = 10;
  QVector<size_t> cDims(1, 5);
  QString name("Source Array");

  // First lets try it without allocating any memory
  typename DataArray<T>::Pointer src = DataArray<T>::CreateArray(numTuples, cDims, name, false);

  typename DataArray<T>::Pointer copy = DataArray<T>::CreateArray(numTuples, cDims, name, false);

  DREAM3D_REQUIRED(copy->getNumberOfTuples(), ==, src->getNumberOfTuples() );
  DREAM3D_REQUIRED(copy->isAllocated(), ==, src->isAllocated() );

  // Create the array again, this time allocating the data and putting in some known data
  src = DataArray<T>::CreateArray(numTuples, cDims, name, true);
  copy = DataArray<T>::CreateArray(numTuples, cDims, name, true);

  for(size_t i = 0; i < numTuples; i++)
  {
    for(size_t j = 0; j < cDims[0]; j++)
    {
      src->setComponent(i, j, static_cast<T>(i + j) );
      copy->setComponent(i, j, static_cast<T>(i + j) );
    }
  }

  bool didCopy = src->copyData(numTuples, copy);
  DREAM3D_REQUIRE_EQUAL(didCopy, false);

  src->resize(numTuples * 2);
  didCopy = src->copyData(numTuples, copy);
  DREAM3D_REQUIRE_EQUAL(didCopy, true);

  copy = std::dynamic_pointer_cast<DataArray<T> >(src->deepCopy());
  for(size_t i = 0; i < numTuples; i++)
  {
    for(size_t j = 0; j < cDims[0]; j++)
    {
      src->setComponent(i, j, static_cast<T>(i + j) );
      T cpy = src->getComponent(i+numTuples, j);
      T val = src->getComponent(i, j);
      DREAM3D_REQUIRE_EQUAL(cpy, val)
    }
  }
}
void __TestReorderCopy()
{
    size_t numTuples = 10;
    QVector<size_t> cDims(1, 5);
    QString name("Source Array");

    //make sure that an incorrectly sized order returns a null pointer
    typename DataArray<T>::Pointer src = DataArray<T>::CreateArray(numTuples, cDims, name, false);
    QVector<size_t> wrongSize(numTuples + 1);
    typename DataArray<T>::Pointer copy = boost::dynamic_pointer_cast<DataArray<T> >(src->reorderCopy(wrongSize));
    DREAM3D_REQUIRE_EQUAL(copy.get(), 0);

    // fill reorder vector with same index (using this would be the same result as deep copy)
    QVector<size_t> newOrder(numTuples);
    for(size_t i = 0; i < numTuples; i++)
    {
        newOrder[i] = i;
    }

    //shuffle order
    std::random_shuffle(newOrder.begin(), newOrder.end());

    // First lets try it without allocating any memory
    copy = boost::dynamic_pointer_cast<DataArray<T> >(src->reorderCopy(newOrder));

    //if newOrder is inporperly size a null pointer is returned
    DREAM3D_REQUIRE_NE(copy.get(), 0);

    //check sizes
    DREAM3D_REQUIRED(copy->getNumberOfTuples(), ==, src->getNumberOfTuples() );
    DREAM3D_REQUIRED(copy->isAllocated(), ==, src->isAllocated() );

    // Create the array again, this time allocating the data and putting in some known data
    src = DataArray<T>::CreateArray(numTuples, cDims, name, true);
    for(size_t i = 0; i < src->getSize(); i++)
    {
        src->setValue(i, i);
    }

    for(size_t i = 0; i < numTuples; i++)
    {
        for(size_t j = 0; j < cDims[0]; j++)
        {
            src->setComponent(i, j, static_cast<T>(i * cDims[0] + j) );
        }
    }
    copy = boost::dynamic_pointer_cast<DataArray<T> >(src->reorderCopy(newOrder));
    for(size_t i = 0; i < numTuples; i++)
    {
        for(size_t j = 0; j < cDims[0]; j++)
        {
            T cpy = copy->getComponent(newOrder[i], j);
            T val = src->getComponent(i, j);
            DREAM3D_REQUIRE_EQUAL(cpy, val)
        }
    }
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int RemoveDirectoriesTest()
{
    std::cout  << "|- RemoveDirectoriesTest -----------------" << std::endl;
    int err = 0;
    bool ok;
    std::string testdir = MXAUnitTest::MXATempDir + MXAUnitTest::MXAFileSystemPathTest::TestDir;
    std::cout << "|-- Removing top level test dir: '" << testdir << "'" << std::endl;
    ok = MXADir::rmdir(testdir, false);
    DREAM3D_REQUIRE_EQUAL(ok, true);

    return err;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int DirListTest()
{
    std::cout  << "|- DirListTest -----------------" << std::endl;

    int err = 0;
    std::vector<std::string> list = MXADir::entryList(MXAUnitTest::MXABuildDir);

    for (std::vector<std::string>::iterator iter = list.begin(); iter != list.end(); ++iter ) {
        std::cout << "|--- DIR_LIST_ENTRY--> " << *iter << std::endl;
    }

    std::string ppath = MXADir::parentPath(MXAUnitTest::MXATestBinaryDirectory);
    //std::cout << "Child Path: " << MXAUnitTest::MXATestBinaryDirectory << std::endl;
    //std::cout << "ppath: " << ppath << std::endl;
    //std::cout << "Ref Path:   " << MXAUnitTest::MXABuildDir << std::endl;
    int equal  = ppath.compare(MXAUnitTest::MXABuildDir);
    DREAM3D_REQUIRE_EQUAL(equal, 0);
    return err;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int FilesTest()
{
    std::cout  << "|- FilesTest -----------------" << std::endl;
    int err = 0;
    bool ok;

    std::string testdir = MXAUnitTest::MXATempDir + MXAUnitTest::MXAFileSystemPathTest::TestDir;


    CheckFile(MXAUnitTest::MXAFileSystemPathTest::OutputFile,
              MXAUnitTest::MXAFileSystemPathTest::OutputFileName,
              MXAUnitTest::MXAFileSystemPathTest::Extension);

    std::string testFileName = ".hidden_file";
    std::string testFilePath = testdir + MXAUnitTest::DirSeparator + testFileName;
    std::string ext; // No Extension
    CheckFile(testFilePath, testFileName, ext);

    testFileName = "Normal.txt";
    ok = MXADir::mkdir(testdir + MXAUnitTest::DirSeparator + "Dot.Dir" + MXAUnitTest::DirSeparator, true);
    DREAM3D_REQUIRE_EQUAL(ok, true);
    testFilePath = testdir + MXAUnitTest::DirSeparator + "Dot.Dir" + MXAUnitTest::DirSeparator + testFileName;
    ext = "txt";
    CheckFile(testFilePath, testFileName, ext);
    ok = MXADir::rmdir(testdir + MXAUnitTest::DirSeparator + "Dot.Dir" + MXAUnitTest::DirSeparator, false);
    DREAM3D_REQUIRE_EQUAL(ok, true);

    testFileName = "No_Extension";
    ok = MXADir::mkdir(testdir + MXAUnitTest::DirSeparator + "Dot.Dir" + MXAUnitTest::DirSeparator, true);
    DREAM3D_REQUIRE_EQUAL(ok, true);
    testFilePath = testdir + MXAUnitTest::DirSeparator + "Dot.Dir" + MXAUnitTest::DirSeparator + testFileName;
    ext = "";
    CheckFile(testFilePath, testFileName, ext);
    ok = MXADir::rmdir(testdir + MXAUnitTest::DirSeparator + "Dot.Dir" + MXAUnitTest::DirSeparator, false);
    DREAM3D_REQUIRE_EQUAL(ok, true);

    testFileName = "EndsWithDot.";
    ok = MXADir::mkdir(testdir + MXAUnitTest::DirSeparator + "Dot.Dir" + MXAUnitTest::DirSeparator, true);
    DREAM3D_REQUIRE_EQUAL(ok, true);
    testFilePath = testdir + MXAUnitTest::DirSeparator + "Dot.Dir" + MXAUnitTest::DirSeparator + testFileName;
    ext = "";
    CheckFile(testFilePath, testFileName, ext);
    ok = MXADir::rmdir(testdir + MXAUnitTest::DirSeparator + "Dot.Dir" + MXAUnitTest::DirSeparator, false);
    DREAM3D_REQUIRE_EQUAL(ok, true);


    return err;
}
Exemple #10
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void TestEbsdColoring()
{

  // Create 1 of every type of Ops class. This condenses the code below
  std::vector<OrientationOps::Pointer> ops;
  ops.push_back(HexagonalOps::New());
  ops.push_back(CubicOps::New());
  ops.push_back(HexagonalLowOps::New());
  ops.push_back(CubicLowOps::New());
  ops.push_back(TriclinicOps::New());
  ops.push_back(MonoclinicOps::New());
  ops.push_back(OrthoRhombicOps::New());
  ops.push_back(TetragonalLowOps::New());
  ops.push_back(TetragonalOps::New());
  ops.push_back(TrigonalLowOps::New());
  ops.push_back(TrigonalOps::New());

  double refDir[3] = {0.0, 0.0, 1.0};
  double dEuler[3] = {207.1653, 44.2854, 146.5178};
  DREAM3D::Rgb argb = 0x00000000;
  size_t idx = 0;
  argb = ops[idx++]->generateIPFColor(dEuler, refDir, false);
  argb = ops[idx++]->generateIPFColor(dEuler, refDir, false);
  argb = ops[idx++]->generateIPFColor(dEuler, refDir, false);
  argb = ops[idx++]->generateIPFColor(dEuler, refDir, false);
  argb = ops[idx++]->generateIPFColor(dEuler, refDir, false);
  argb = ops[idx++]->generateIPFColor(dEuler, refDir, false);
  argb = ops[idx++]->generateIPFColor(dEuler, refDir, false);
  argb = ops[idx++]->generateIPFColor(dEuler, refDir, false);
  argb = ops[idx++]->generateIPFColor(dEuler, refDir, false);
  argb = ops[idx++]->generateIPFColor(dEuler, refDir, false);
  argb = ops[idx++]->generateIPFColor(dEuler, refDir, false);

  DREAM3D_REQUIRE_EQUAL(idx, Ebsd::CrystalStructure::LaueGroupEnd)

  std::cout << RgbColor::dRed(argb) << " " << RgbColor::dGreen(argb) << " " << RgbColor::dBlue(argb) << " " << std::endl;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int MakeDirectoriesTest()
{

    std::cout  << "|- MakeDirectoriesTest -----------------" << std::endl;
    int err = 0;
    bool exists;
    bool isDir;
    bool isFile;
    bool ok;
    bool isRelative;
    bool isAbsolute;

    std::string testdir = MXAUnitTest::MXATempDir + MXAUnitTest::MXAFileSystemPathTest::TestDir;


    std::string dirPath( testdir
                         + MXADir::Separator
                         + MXAUnitTest::MXAFileSystemPathTest::TestDirName1
                         + MXADir::Separator);
    std::cout << "|-- Creating Deeply Nested Directories: '" << dirPath << "'" << std::endl;

    exists = MXADir::exists(dirPath);
    DREAM3D_REQUIRE_EQUAL(exists, false);
    err = MXADir::mkdir(dirPath, true);
    DREAM3D_REQUIRE_EQUAL(err, 1);
    isDir = MXADir::isDirectory(dirPath);
    DREAM3D_REQUIRE_EQUAL(isDir, true);
    isFile = MXADir::isFile(dirPath);
    DREAM3D_REQUIRE_EQUAL(isFile, false);
    exists = MXADir::exists(dirPath);
    DREAM3D_REQUIRE_EQUAL(exists, true);
    ok = MXADir::rmdir(dirPath, false);
    DREAM3D_REQUIRE_EQUAL(ok, true);
    exists = MXADir::exists(dirPath);
    DREAM3D_REQUIRE_EQUAL(exists, false);

    dirPath = testdir
              + MXADir::Separator
              + MXAUnitTest::MXAFileSystemPathTest::TestDirName1;

    exists = MXADir::exists(dirPath);
    DREAM3D_REQUIRE_EQUAL(exists, false);
    err = MXADir::mkdir(dirPath, true);
    DREAM3D_REQUIRE_EQUAL(err, 1);
    isDir = MXADir::isDirectory(dirPath);
    DREAM3D_REQUIRE_EQUAL(isDir, true);
    isFile = MXADir::isFile(dirPath);
    DREAM3D_REQUIRE_EQUAL(isFile, false);
    exists = MXADir::exists(dirPath);
    DREAM3D_REQUIRE_EQUAL(exists, true);
    ok = MXADir::rmdir(dirPath, false);
    DREAM3D_REQUIRE_EQUAL(ok, true);
    exists = MXADir::exists(dirPath);
    DREAM3D_REQUIRE_EQUAL(exists, false);

    isRelative = MXADir::isRelativePath(dirPath);
    DREAM3D_REQUIRE_EQUAL(isRelative, false);
    isAbsolute = MXADir::isAbsolutePath(dirPath);
    DREAM3D_REQUIRE_EQUAL(isAbsolute, true);


#if defined (WIN32)
    dirPath = "C:\\";
#else
    dirPath = "/tmp";
#endif

    exists = MXADir::exists(dirPath);
    DREAM3D_REQUIRE_EQUAL(exists, true);

    std::string path = MXADir::cleanPath(dirPath);
    DREAM3D_REQUIRE_EQUAL(path.compare(dirPath), 0)

    err = MXADir::mkdir(dirPath, true);
    DREAM3D_REQUIRE_EQUAL(err, 1);

    isDir = MXADir::isDirectory(dirPath);
    DREAM3D_REQUIRE_EQUAL(isDir, true);

    isFile = MXADir::isFile(dirPath);
    DREAM3D_REQUIRE_EQUAL(isFile, false);

    exists = MXADir::exists(dirPath);
    DREAM3D_REQUIRE_EQUAL(exists, true);


    isRelative = MXADir::isRelativePath(dirPath);
    DREAM3D_REQUIRE_EQUAL(isRelative, false);

    isAbsolute = MXADir::isAbsolutePath(dirPath);
    DREAM3D_REQUIRE_EQUAL(isAbsolute, true);

#ifndef _MSC_VER
    path = MXADir::cleanPath("/tmp/");
    if (path.compare("/tmp") != 0)
    {
        std::cout << "This is bad" << std::endl;
    }

    path = MXADir::cleanPath("/tmp/Other");
    if (path.compare("/tmp/Other") != 0)
    {
        std::cout << "This is bad" << std::endl;
    }
#endif


    return err;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int FileNameTest()
{
    int err = 0;

    std::string filename = "some.thing";
    std::string filepath = filename;
    std::string ext = "thing";
    CheckFile(filepath, filename, ext);

    filename = ".some.thing";
    filepath = filename;
    ext = "thing";
    CheckFile(filepath, filename, ext);

    filename = ".something";
    filepath = filename;
    ext = "";
    CheckFile(filepath, filename, ext);

    filename = "something";
    filepath = filename;
    ext = "";
    CheckFile(filepath, filename, ext);

    filename = "something.";
    filepath = filename;
    ext = "";
    CheckFile(filepath, filename, ext);

    filename = ".some.thing.";
    filepath = filename;
    ext = "";
    CheckFile(filepath, filename, ext);


//------------------------------------------------------
#if defined (WIN32)
    const std::string DirSeparator = "\\";
#else
    const std::string DirSeparator = "/";
#endif
    filename = "some.thing";
    filepath = MXAUnitTest::MXATempDir + filename;
    ext = "thing";
    CheckFile(filepath, filename, ext);

    filename = ".some.thing";
    filepath = MXAUnitTest::MXATempDir + filename;
    ext = "thing";
    CheckFile(filepath, filename, ext);

    filename = ".something";
    filepath = MXAUnitTest::MXATempDir +  filename;
    ext = "";
    CheckFile(filepath, filename, ext);

    filename = "something";
    filepath = MXAUnitTest::MXATempDir + filename;
    ext = "";
    CheckFile(filepath, filename, ext);

    filename ="something.";
    filepath =  MXAUnitTest::MXATempDir + filename;
    ext = "";
    CheckFile(filepath, filename, ext);

    filename = ".some.thing.";
    filepath = MXAUnitTest::MXATempDir + filename;
    ext = "";
    CheckFile(filepath, filename, ext);

    bool exists = MXADir::exists(std::string(""));
    DREAM3D_REQUIRE_EQUAL(exists, false);

    return err;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int FileNameExtensionTest()
{
    std::cout  << "|- FileNameExtensionTest -----------------" << std::endl;
    int err = 0;
#if 0
    std::string file("SomeFile.txt");
    std::string base = MXADir::fileNameWithOutExtension(file);
    DREAM3D_REQUIRE_EQUAL(base, "SomeFile");

    file ="SomeFile";
    base = MXADir::fileNameWithOutExtension(file);
    DREAM3D_REQUIRE_EQUAL(base, "SomeFile");


    file ="SomeFile.";
    base = MXADir::fileNameWithOutExtension(file);
    DREAM3D_REQUIRE_EQUAL(base, "SomeFile.");


    file ="SomeFile.txt.bin";
    base = MXADir::fileNameWithOutExtension(file);
    DREAM3D_REQUIRE_EQUAL(base, "SomeFile.txt");

    file ="/SomePath/To/SomeFile.txt.bin";
    base = MXADir::fileNameWithOutExtension(file);
    DREAM3D_REQUIRE_EQUAL(base, "SomeFile.txt");
#endif


    std::string testdir = MXAUnitTest::MXATempDir + MXAUnitTest::MXAFileSystemPathTest::TestDir + MXAUnitTest::DirSeparator;

    std::string fnBase = ".hidden_file";
    std::string test = ".hidden_file";
    std::string testFileName = testdir + fnBase;
    std::string ext = "";
    std::string fnWoExt = MXAFileInfo::fileNameWithOutExtension(testFileName);
    DREAM3D_REQUIRE_EQUAL(fnWoExt, test);


    fnBase = "Normal.txt";
    test = "Normal";
    testFileName = testdir + fnBase;
    fnWoExt = MXAFileInfo::fileNameWithOutExtension(testFileName);
    DREAM3D_REQUIRE_EQUAL(fnWoExt, test);

    fnBase = "No_Extension";
    test = "No_Extension";
    testFileName = testdir + fnBase;
    fnWoExt = MXAFileInfo::fileNameWithOutExtension(testFileName);
    DREAM3D_REQUIRE_EQUAL(fnWoExt, test);

    fnBase = "EndsWithDot.";
    test = "EndsWithDot";
    testFileName = testdir + fnBase;
    fnWoExt = MXAFileInfo::fileNameWithOutExtension(testFileName);
    DREAM3D_REQUIRE_EQUAL(fnWoExt, test);


    fnBase = "Normal.txt.bin";
    test = "Normal.txt";
    testFileName = testdir + fnBase;
    fnWoExt = MXAFileInfo::fileNameWithOutExtension(testFileName);
    DREAM3D_REQUIRE_EQUAL(fnWoExt, test);
    ext = MXAFileInfo::extension(testFileName);
    DREAM3D_REQUIRE_EQUAL(ext, "bin");

    fnBase = ".txt.bin";
    test = ".txt";
    testFileName = testdir + fnBase;
    fnWoExt = MXAFileInfo::fileNameWithOutExtension(testFileName);
    DREAM3D_REQUIRE_EQUAL(fnWoExt, test);
    ext = MXAFileInfo::extension(testFileName);
    DREAM3D_REQUIRE_EQUAL(ext, "bin");

    fnBase = "";
    test = "";
    testFileName = fnBase;
    fnWoExt = MXAFileInfo::fileNameWithOutExtension(testFileName);
    DREAM3D_REQUIRE_EQUAL(fnWoExt, test);
    ext = MXAFileInfo::extension(testFileName);
    DREAM3D_REQUIRE_EQUAL(ext, "");


    return err;
}
Exemple #14
0
void __TestcopyTuples()
{
  int err = 0;
  QVector<size_t> dims(1, NUM_COMPONENTS_2);
  typename DataArray<T>::Pointer array = DataArray<T>::CreateArray(NUM_TUPLES_2, dims, "TestcopyTuples");
  DREAM3D_REQUIRE_EQUAL(array->isAllocated(), true);

  for(size_t i = 0; i < NUM_TUPLES_2; ++i)
  {
    array->setComponent(i, 0, static_cast<T>(i));
    array->setComponent(i, 1, static_cast<T>(i));
  }

  err = array->copyTuple(0, 1);
  DREAM3D_REQUIRE_EQUAL(0, err);
  err = array->copyTuple(3, 2);
  DREAM3D_REQUIRE_EQUAL(0, err);
  err = array->copyTuple(4, 5);
  DREAM3D_REQUIRE_EQUAL(0, err);
  err = array->copyTuple(8, 9);
  DREAM3D_REQUIRE_EQUAL(0, err);
  err = array->copyTuple(18, 19);
  DREAM3D_REQUIRE_EQUAL(-1, err);

  DREAM3D_REQUIRE_EQUAL(array->getComponent(1, 0), 0);
  DREAM3D_REQUIRE_EQUAL(array->getComponent(1, 1), 0);
  DREAM3D_REQUIRE_EQUAL(array->getComponent(2, 0), 3);
  DREAM3D_REQUIRE_EQUAL(array->getComponent(2, 1), 3);
  DREAM3D_REQUIRE_EQUAL(array->getComponent(5, 0), 4);
  DREAM3D_REQUIRE_EQUAL(array->getComponent(5, 1), 4);
  DREAM3D_REQUIRE_EQUAL(array->getComponent(9, 0), 8);
  DREAM3D_REQUIRE_EQUAL(array->getComponent(9, 1), 8);
}
Exemple #15
0
  int __ValidateArray(typename DataArray<T>::Pointer array, size_t numTuples, int numComp)
  {
    int err = 0;
    DREAM3D_REQUIRED(true, ==, array->isAllocated() );
    size_t nt = array->getNumberOfTuples();
    DREAM3D_REQUIRED(nt, ==, numTuples);
    int nc = array->getNumberOfComponents();
    DREAM3D_REQUIRED(nc, ==, numComp );

    size_t typeSize = array->getTypeSize();
    DREAM3D_REQUIRE_EQUAL(sizeof(T), typeSize);

    size_t numElements = array->getSize();
    DREAM3D_REQUIRED(numElements, ==, (nt * nc) );
    // initialize the array with zeros to get a baseline
    array->initializeWithZeros();
    // Get a pointer to the data and loop through the array making sure all values are Zero
    T* ptr = array->getPointer(0);
    for(size_t i = 0; i < numElements; i++)
    {
      DREAM3D_REQUIRE_EQUAL(0, ptr[i]);
    }
    //Splat another value across the array starting at an offset into the array
    //and test those values made it into the array correctly
    array->initializeWithValue(static_cast<T>(1), numComp);
    for(size_t i = numComp; i < numElements; i++)
    {
      DREAM3D_REQUIRE_EQUAL(static_cast<T>(1), ptr[i]);
    }
    // Initialize the entire array with a value (offset = 0);
    array->initializeWithValue(static_cast<T>(2), 0);
    for(size_t i = 0; i < numElements; i++)
    {
      DREAM3D_REQUIRE_EQUAL(static_cast<T>(2), ptr[i]);
    }

    // Initialize the entire array with a value (offset = 0), this time using the default value for the offset
    array->initializeWithValue(static_cast<T>(3));
    ptr = array->getPointer(0);
    for(size_t i = 0; i < numElements; i++)
    {
      DREAM3D_REQUIRE_EQUAL(static_cast<T>(3), ptr[i]);
      array->setValue(i, static_cast<T>(4));
      T val = array->getValue(i);
      DREAM3D_REQUIRE_EQUAL(val, static_cast<T>(4))
    }


    // Test setting of a Tuple with a value, which means all components of that tuple will have the same value
    size_t index = 0;
    array->initializeWithZeros();
    for(size_t t = 0; t < numTuples; t++)
    {
      array->initializeTuple(t, 6.0);
      for(int j = 0; j < numComp; j++)
      {
        T val = array->getComponent(t, j);
        DREAM3D_REQUIRE_EQUAL(val, (static_cast<T>(6)) )
      }
    }

    // Test setting individual components to a specific value
    index = 0;
    array->initializeWithZeros();
    for(size_t t = 0; t < numTuples; t++)
    {
      for(int j = 0; j < numComp; j++)
      {
        index = t * numComp + j;
        array->setComponent(t, j, static_cast<T>(t + j) );
        T val = array->getComponent(t, j);
        DREAM3D_REQUIRE_EQUAL(val, (static_cast<T>(t + j)))
        val = array->getValue(index);
        DREAM3D_REQUIRE_EQUAL(val, (static_cast<T>(t + j)))
      }
    }


    ///     virtual QVector<size_t> getComponentDimensions()
    // Test resizing the array based on a give number of tuples. The number of Components will stay the same at each tuple
    array->resize(numTuples * 2);
    array->initializeWithZeros(); // Init the grown array to all Zeros
    nt = array->getNumberOfTuples();
    DREAM3D_REQUIRED(nt, ==, (numTuples * 2) );
    nc = array->getNumberOfComponents();
    DREAM3D_REQUIRED(nc, ==, numComp );

    // Test resizing the array to a smaller size
    array->resize(numTuples);
    array->initializeWithZeros(); // Init the grown array to all Zeros
    nt = array->getNumberOfTuples();
    DREAM3D_REQUIRED(nt, ==, (numTuples) );
    nc = array->getNumberOfComponents();
    DREAM3D_REQUIRED(nc, ==, numComp );


    ////clear()

    // This resizes the array to Zero destroying all the data in the process.
    array->clear();
    DREAM3D_REQUIRED(false, ==, array->isAllocated() );
    nt = array->getNumberOfTuples();
    DREAM3D_REQUIRED(nt, ==, 0);
    nc = array->getNumberOfComponents();
    DREAM3D_REQUIRED(nc, ==, numComp);
    nt = array->getSize();
    DREAM3D_REQUIRED(nt, ==, 0);
    ptr = array->getPointer(0);
    DREAM3D_REQUIRED_PTR(ptr, ==, NULL);


    // Test resizing the array to a any larger size
    array->resize(numTuples);
    array->initializeWithZeros(); // Init the grown array to all Zeros
    nt = array->getNumberOfTuples();
    DREAM3D_REQUIRED(nt, ==, (numTuples) );
    nc = array->getNumberOfComponents();
    DREAM3D_REQUIRED(nc, ==, numComp );
    ptr = array->getPointer(0);
    DREAM3D_REQUIRED_PTR(ptr, !=, NULL);

    return err;
  }
Exemple #16
0
  void __TestNeighborList()
  {
    typename NeighborList<T>::Pointer n = NeighborList<T>::New();
    n->setName("Test");

    for(int i = 0; i < 4; ++i)
    {
      for(T j = 0; j < (T)(i + 4); ++j)
      {
        n->addEntry(i, static_cast<T>(j * i + 3) );
      }
    }

    typename NeighborList<T>::SharedVectorType v;
    for(int i = 0; i < 4; ++i)
    {
      v = n->getList(i);
      DREAM3D_REQUIRE_NE(v.get(), 0);
    }

    // Remove the front 2 elements and test
    QVector<size_t> eraseElements;
    eraseElements.push_back(0);
    eraseElements.push_back(1);

    n->eraseTuples(eraseElements);
    for(int i = 0; i < 2; ++i)
    {
      v = n->getList(i);
      DREAM3D_REQUIRE_NE(v.get(), 0);
      DREAM3D_REQUIRE_EQUAL(v->size(), static_cast<size_t>(i + 2 + 4) );
      for(T j = 0; j < (T)(i + 4 + 2); ++j)
      {
        DREAM3D_REQUIRE_EQUAL(v->at(j), j * (i + 2) + 3);
      }
    }

    // Reset and erase the back 2 "Tuples"
    n->clearAllLists();
    for(int i = 0; i < 4; ++i)
    {
      for(T j = 0; j < (T)(i + 4); ++j)
      {
        n->addEntry(i, j * i + 3);
      }
    }
    eraseElements.clear();
    eraseElements.push_back(2);
    eraseElements.push_back(3);
    n->eraseTuples(eraseElements);
    for(int i = 0; i < 2; ++i)
    {
      v = n->getList(i);
      DREAM3D_REQUIRE_NE(v.get(), 0);
      DREAM3D_REQUIRE_EQUAL(v->size(), static_cast<size_t>(i + 4) );
      for(T j = 0; j < (T)(i + 4); ++j)
      {
        DREAM3D_REQUIRE_EQUAL(v->at(j), j * i + 3);
      }
    }

    // Reset and erase the back 2 "Tuples"
    n->clearAllLists();
    for(int i = 0; i < 4; ++i)
    {
      for(T j = 0; j < (T)(i + 4); ++j)
      {
        n->addEntry(i, j * i + 3);
      }
    }
    eraseElements.clear();
    eraseElements.push_back(1);
    eraseElements.push_back(2);
    n->eraseTuples(eraseElements);
    int i = 0;
    v = n->getList(i);
    DREAM3D_REQUIRE_NE(v.get(), 0);
    DREAM3D_REQUIRE_EQUAL(v->size(), static_cast<size_t>(i + 4) );
    for(T j = 0; j < (T)(i + 4); ++j)
    {
      DREAM3D_REQUIRE_EQUAL(v->at(j), j * i + 3);
    }
    i = 1;
    v = n->getList(i);
    DREAM3D_REQUIRE_NE(v.get(), 0);
    i = 3;
    DREAM3D_REQUIRE_EQUAL(v->size(), static_cast<size_t>(i + 4) );
    for(T j = 0; j < (T)(i + 4); ++j)
    {
      DREAM3D_REQUIRE_EQUAL(v->at(j), j * i + 3);
    }
  }
Exemple #17
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
  void TestDataArray()
  {
    int32_t* ptr = NULL;
    {
      Int32ArrayType::Pointer d = Int32ArrayType::CreateArray(0, "Test7");
      DREAM3D_REQUIRE_EQUAL(0, d->getSize());
      DREAM3D_REQUIRE_EQUAL(0, d->getNumberOfTuples());
      ptr = d->getPointer(0);
      DREAM3D_REQUIRE_EQUAL(ptr, 0);
      DREAM3D_REQUIRE_EQUAL(d->isAllocated(), false);
    }

    {
      QVector<size_t> dims(1, NUM_COMPONENTS);
      Int32ArrayType::Pointer int32Array = Int32ArrayType::CreateArray(NUM_ELEMENTS, dims, "Test8");
      ptr = int32Array->getPointer(0);
      DREAM3D_REQUIRE_EQUAL(int32Array->isAllocated(), true);
      DREAM3D_REQUIRE_EQUAL(NUM_ELEMENTS, int32Array->getNumberOfTuples());
      DREAM3D_REQUIRE_EQUAL(NUM_ELEMENTS * NUM_COMPONENTS, int32Array->getSize());

      for (int i = 0; i < NUM_TUPLES; ++i)
      {
        for (int c = 0; c < NUM_COMPONENTS; ++c)
        {
          int32Array->setComponent(i, c, i + c);
        }
      }

      // Resize Larger
      int32Array->resize(NUM_TUPLES_2);
      DREAM3D_REQUIRE_EQUAL(NUM_TUPLES_2, int32Array->getNumberOfTuples());
      DREAM3D_REQUIRE_EQUAL(NUM_ELEMENTS_2, int32Array->getSize());
      DREAM3D_REQUIRE_EQUAL(int32Array->isAllocated(), true);

      // This should have saved our data so lets look at the data and compare it
      for (int i = 0; i < NUM_TUPLES; ++i)
      {
        for (int c = 0; c < NUM_COMPONENTS; ++c)
        {
          DREAM3D_REQUIRE_EQUAL( (int32Array->getComponent(i, c)), (i + c))
        }
      }

      // Resize Smaller - Which should have still saved some of our data
      int32Array->resize(NUM_TUPLES_3);
      DREAM3D_REQUIRE_EQUAL(NUM_TUPLES_3, int32Array->getNumberOfTuples());
      DREAM3D_REQUIRE_EQUAL(NUM_ELEMENTS_3, int32Array->getSize());
      DREAM3D_REQUIRE_EQUAL(int32Array->isAllocated(), true);

      // This should have saved our data so lets look at the data and compare it
      for (int i = 0; i < NUM_TUPLES; ++i)
      {
        for (int c = 0; c < NUM_COMPONENTS; ++c)
        {
          DREAM3D_REQUIRE_EQUAL( (int32Array->getComponent(i, c)), (i + c))
        }
      }

      // Change number of components
      //    dims[0] = NUM_COMPONENTS_4;
      //    int32Array->setDims(dims);
      //    DREAM3D_REQUIRE_EQUAL(NUM_TUPLES_4, int32Array->getNumberOfTuples());
      //    DREAM3D_REQUIRE_EQUAL(NUM_ELEMENTS_4, int32Array->getSize());

      double temp = 9999;
      int32Array->initializeTuple(0, temp );
      for (int c = 0; c < NUM_COMPONENTS; ++c)
      {
        DREAM3D_REQUIRE_EQUAL( (int32Array->getComponent(0, c)), (9999))
      }


      ptr = int32Array->getPointer(0);
    }

  }
Exemple #18
0
void __TestEraseElements()
{
  // Test dropping of front elements only
  {
    typename DataArray<T>::Pointer array = DataArray<T>::CreateArray(NUM_ELEMENTS, "Test1");
    DREAM3D_REQUIRE_EQUAL(array->isAllocated(), true);
    for(size_t i = 0; i < NUM_ELEMENTS; ++i)
    {
      array->setComponent(i, 0, static_cast<T>(i) );
    }

    QVector<size_t> eraseElements;
    eraseElements.push_back(0);
    eraseElements.push_back(1);

    array->eraseTuples(eraseElements);

    DREAM3D_REQUIRE_EQUAL(array->getValue(0), 2);
    DREAM3D_REQUIRE_EQUAL(array->getValue(1), 3);
    DREAM3D_REQUIRE_EQUAL(array->getValue(2), 4);
    DREAM3D_REQUIRE_EQUAL(array->isAllocated(), true);
  }

  // Test Dropping of internal elements
  {
    QVector<size_t> dims(1, NUM_COMPONENTS_2);
    typename DataArray<T>::Pointer array = DataArray<T>::CreateArray(NUM_ELEMENTS_2, dims, "Test2");
    DREAM3D_REQUIRE_EQUAL(array->isAllocated(), true);
    for(size_t i = 0; i < NUM_TUPLES_2; ++i)
    {
      array->setComponent(i, 0, static_cast<T>(i));
      array->setComponent(i, 1, static_cast<T>(i));
    }

    QVector<size_t> eraseElements;
    eraseElements.push_back(3);
    eraseElements.push_back(6);
    eraseElements.push_back(8);

    array->eraseTuples(eraseElements);

    DREAM3D_REQUIRE_EQUAL(array->getComponent(3, 0), 4);
    DREAM3D_REQUIRE_EQUAL(array->getComponent(3, 1), 4);
    DREAM3D_REQUIRE_EQUAL(array->getComponent(5, 0), 7);
    DREAM3D_REQUIRE_EQUAL(array->getComponent(5, 1), 7);
    DREAM3D_REQUIRE_EQUAL(array->getComponent(6, 0), 9);
    DREAM3D_REQUIRE_EQUAL(array->getComponent(6, 1), 9);
  }

  // Test Dropping of internal elements
  {
    QVector<size_t> dims(1, NUM_COMPONENTS_2);
    typename DataArray<T>::Pointer array = DataArray<T>::CreateArray(NUM_ELEMENTS_2, dims, "Test3");
    DREAM3D_REQUIRE_EQUAL(array->isAllocated(), true);
    for(size_t i = 0; i < NUM_TUPLES_2; ++i)
    {
      array->setComponent(i, 0, static_cast<T>(i));
      array->setComponent(i, 1, static_cast<T>(i));
    }

    QVector<size_t> eraseElements;
    eraseElements.push_back(3);
    eraseElements.push_back(6);
    eraseElements.push_back(9);
    array->eraseTuples(eraseElements);

    DREAM3D_REQUIRE_EQUAL(array->getComponent(3, 0), 4);
    DREAM3D_REQUIRE_EQUAL(array->getComponent(3, 1), 4);
    DREAM3D_REQUIRE_EQUAL(array->getComponent(5, 0), 7);
    DREAM3D_REQUIRE_EQUAL(array->getComponent(5, 1), 7);
    DREAM3D_REQUIRE_EQUAL(array->getComponent(6, 0), 8);
    DREAM3D_REQUIRE_EQUAL(array->getComponent(6, 1), 8);
  }

  // Test Dropping of internal continuous elements
  {
    QVector<size_t> dims(1, NUM_COMPONENTS_2);
    typename DataArray<T>::Pointer array = DataArray<T>::CreateArray(NUM_ELEMENTS_2, dims, "Test4");
    DREAM3D_REQUIRE_EQUAL(array->isAllocated(), true);
    for(size_t i = 0; i < NUM_TUPLES_2; ++i)
    {
      array->setComponent(i, 0, static_cast<T>(i));
      array->setComponent(i, 1, static_cast<T>(i));
    }

    QVector<size_t> eraseElements;
    eraseElements.push_back(3);
    eraseElements.push_back(4);
    eraseElements.push_back(5);
    array->eraseTuples(eraseElements);

    DREAM3D_REQUIRE_EQUAL(array->getComponent(3, 0), 6);
    DREAM3D_REQUIRE_EQUAL(array->getComponent(3, 1), 6);
    DREAM3D_REQUIRE_EQUAL(array->getComponent(4, 0), 7);
    DREAM3D_REQUIRE_EQUAL(array->getComponent(4, 1), 7);
    DREAM3D_REQUIRE_EQUAL(array->getComponent(5, 0), 8);
    DREAM3D_REQUIRE_EQUAL(array->getComponent(5, 1), 8);
  }

  // Test Dropping of Front and Back Elements
  {
    QVector<size_t> dims(1, NUM_COMPONENTS_2);
    typename DataArray<T>::Pointer array = DataArray<T>::CreateArray(NUM_ELEMENTS_2, dims, "Test5");
    DREAM3D_REQUIRE_EQUAL(array->isAllocated(), true);
    for(size_t i = 0; i < NUM_TUPLES_2; ++i)
    {
      array->setComponent(i, 0, static_cast<T>(i));
      array->setComponent(i, 1, static_cast<T>(i));
    }

    QVector<size_t> eraseElements;
    eraseElements.push_back(0);
    eraseElements.push_back(9);

    array->eraseTuples(eraseElements);

    DREAM3D_REQUIRE_EQUAL(array->getComponent(0, 0), 1);
    DREAM3D_REQUIRE_EQUAL(array->getComponent(0, 1), 1);
    DREAM3D_REQUIRE_EQUAL(array->getComponent(7, 0), 8);
    DREAM3D_REQUIRE_EQUAL(array->getComponent(7, 1), 8);
  }

  // Test Dropping of Back Elements
  {
    QVector<size_t> dims(1, NUM_COMPONENTS_2);
    typename DataArray<T>::Pointer array = DataArray<T>::CreateArray(NUM_ELEMENTS_2, dims, "Test6");
    DREAM3D_REQUIRE_EQUAL(array->isAllocated(), true);
    for(size_t i = 0; i < NUM_TUPLES_2; ++i)
    {
      array->setComponent(i, 0, static_cast<T>(i));
      array->setComponent(i, 1, static_cast<T>(i));
    }

    QVector<size_t> eraseElements;
    eraseElements.push_back(7);
    eraseElements.push_back(8);
    eraseElements.push_back(9);
    array->eraseTuples(eraseElements);

    DREAM3D_REQUIRE_EQUAL(array->getComponent(4, 0), 4);
    DREAM3D_REQUIRE_EQUAL(array->getComponent(4, 1), 4);
    DREAM3D_REQUIRE_EQUAL(array->getComponent(5, 0), 5);
    DREAM3D_REQUIRE_EQUAL(array->getComponent(5, 1), 5);
  }

  // Test Dropping of indices larger than the number of tuples
  {
    QVector<size_t> dims(1, NUM_COMPONENTS_2);
    typename DataArray<T>::Pointer array = DataArray<T>::CreateArray(NUM_TUPLES_2, dims, "Test6");
    DREAM3D_REQUIRE_EQUAL(array->isAllocated(), true);
    for(size_t i = 0; i < NUM_TUPLES_2; ++i)
    {
      array->setComponent(i, 0, static_cast<T>(i));
      array->setComponent(i, 1, static_cast<T>(i));
    }

    QVector<size_t> eraseElements;
    eraseElements.push_back(10);
    int err = array->eraseTuples(eraseElements);
    DREAM3D_REQUIRE_EQUAL(err , -100)

    eraseElements.clear();
    err = array->eraseTuples(eraseElements);
    DREAM3D_REQUIRE_EQUAL(err , 0)

    eraseElements.resize(20);
    err = array->eraseTuples(eraseElements);
    DREAM3D_REQUIRE_EQUAL(err , 0)
    size_t nTuples = array->getNumberOfTuples();
    DREAM3D_REQUIRE_EQUAL(nTuples, 0)
  }

}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void TestSyntheticBuilder()
{

  MXADir::mkdir(m_OutputDirectory, true);

  Observer* observer = new Observer;


  int err = 0;

  // Create our Pipeline object
  FilterPipeline::Pointer pipeline = FilterPipeline::New();
  VoxelDataContainer::Pointer m = VoxelDataContainer::New();
  pipeline->setVoxelDataContainer(m);

    ShapeTypeArrayType::Pointer m_ShapeTypes = ShapeTypeArrayType::CreateArray(4, DREAM3D::EnsembleData::ShapeTypes);
    m_ShapeTypes->SetValue(0, DREAM3D::ShapeType::UnknownShapeType);
    m_ShapeTypes->SetValue(1, DREAM3D::ShapeType::EllipsoidShape);
    m_ShapeTypes->SetValue(2, DREAM3D::ShapeType::EllipsoidShape);
    m_ShapeTypes->SetValue(3, DREAM3D::ShapeType::EllipsoidShape);

    InitializeSyntheticVolume::Pointer init_volume = InitializeSyntheticVolume::New();
    init_volume->setShapeTypes(m_ShapeTypes);
    init_volume->setInputFile(getH5StatsFile());
    init_volume->setXVoxels(m_XPoints);
    init_volume->setYVoxels(m_YPoints);
    init_volume->setZVoxels(m_ZPoints);
    init_volume->setXRes(m_XResolution);
    init_volume->setYRes(m_YResolution);
    init_volume->setZRes(m_ZResolution);
	pipeline->pushBack(init_volume);

    PackPrimaryPhases::Pointer pack_grains = PackPrimaryPhases::New();
    pack_grains->setPeriodicBoundaries(m_PeriodicBoundary);
    pack_grains->setNeighborhoodErrorWeight(m_NeighborhoodErrorWeight);
#if PACK_GRAINS_ERROR_TXT_OUT
    MAKE_OUTPUT_FILE_PATH( errorFile, DREAM3D::SyntheticBuilder::ErrorFile)
    pack_grains->setErrorOutputFile(errorFile);
#endif
#if PACK_GRAINS_VTK_FILE_OUT
    MAKE_OUTPUT_FILE_PATH( vtkFile, DREAM3D::SyntheticBuilder::VtkFile)
    pack_grains->setVtkOutputFile(vtkFile);
#endif
    pipeline->pushBack(pack_grains);

    AdjustVolume::Pointer adjust_grains = AdjustVolume::New();
    pipeline->pushBack(adjust_grains);

    InsertPrecipitatePhases::Pointer place_precipitates = InsertPrecipitatePhases::New();
    place_precipitates->setPeriodicBoundaries(m_PeriodicBoundary);
    pipeline->pushBack(place_precipitates);

  MatchCrystallography::Pointer match_crystallography = MatchCrystallography::New();
//  pipeline->pushBack(match_crystallography);

  FieldDataCSVWriter::Pointer write_fielddata = FieldDataCSVWriter::New();
  write_fielddata->setFieldDataFile(UnitTest::SyntheticBuilderTest::CsvFile);
  pipeline->pushBack(write_fielddata);

  DataContainerWriter::Pointer writer = DataContainerWriter::New();
  writer->setOutputFile(UnitTest::SyntheticBuilderTest::OutputFile);
  pipeline->pushBack(writer);

  bool m_WriteVtkFile(true);
  bool m_WriteBinaryVTKFiles(true);
  bool m_WritePhaseId(true);
  bool m_WriteIPFColor(false);

  if(m_WriteVtkFile)
  {
    VtkRectilinearGridWriter::Pointer vtkWriter = VtkRectilinearGridWriter::New();
    vtkWriter->setOutputFile(UnitTest::SyntheticBuilderTest::VtkOutputFile);
    vtkWriter->setWriteGrainIds(true);
    vtkWriter->setWritePhaseIds(m_WritePhaseId);
   // vtkWriter->setWriteGoodVoxels(m_WriteGoodVoxels);
    vtkWriter->setWriteIPFColors(m_WriteIPFColor);
    vtkWriter->setWriteBinaryFile(m_WriteBinaryVTKFiles);
    pipeline->pushBack(vtkWriter);
  }

  std::cout << "********* RUNNING PIPELINE **********************" << std::endl;

  m = VoxelDataContainer::New();

  pipeline->setVoxelDataContainer(m);
  pipeline->run();
  err = pipeline->getErrorCondition();
  DREAM3D_REQUIRE_EQUAL(err, 0);

  DREAM3D_REQUIRE_EQUAL(false, pipeline->empty());

  pipeline->clear();
  DREAM3D_REQUIRE_EQUAL(0, pipeline->size());
  DREAM3D_REQUIRE_EQUAL(true, pipeline->empty());

  delete observer;
}