コード例 #1
0
ファイル: InitializeData.cpp プロジェクト: kglowins/DREAM3D
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void InitializeData::readFilterParameters(AbstractFilterParametersReader* reader, int index)
{
  reader->openFilterGroup(this, index);
  setCellAttributeMatrixPath( reader->readDataArrayPath("CellAttributeMatrixPath", getCellAttributeMatrixPath() ) );
  setXMin( reader->readValue("XMin", getXMin()) );
  setYMin( reader->readValue("YMin", getYMin()) );
  setZMin( reader->readValue("ZMin", getZMin()) );
  setXMax( reader->readValue("XMax", getXMax()) );
  setYMax( reader->readValue("YMax", getYMax()) );
  setZMax( reader->readValue("ZMax", getZMax()) );
  reader->closeFilterGroup();
}
コード例 #2
0
BinnedMap::BinnedMap( QObject */*parent*/, const QStringList &/*args*/ )
    : KstDataObject() {
    _typeString = i18n("Plugin");
    _type = "Plugin";

    setXMin(-1.0);
    setYMin(-1.0);
    setXMax(1.0);
    setYMax(1.0);
    setNX(1);
    setNY(1);
    setAutoBin(false);
}
コード例 #3
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void InitializeData::readFilterParameters(AbstractFilterParametersReader* reader, int index)
{
  reader->openFilterGroup(this, index);
  setCellAttributeMatrixPaths( reader->readDataArrayPathVector("CellAttributeMatrixPaths", getCellAttributeMatrixPaths() ) );
  setXMin( reader->readValue("XMin", getXMin()) );
  setYMin( reader->readValue("YMin", getYMin()) );
  setZMin( reader->readValue("ZMin", getZMin()) );
  setXMax( reader->readValue("XMax", getXMax()) );
  setYMax( reader->readValue("YMax", getYMax()) );
  setZMax( reader->readValue("ZMax", getZMax()) );
  setInitType(reader->readValue("InitType", getInitType()));
  setInitValue(reader->readValue("InitValue", getInitValue()));
  setInitRange(reader->readPairOfDoubles("InitRange", getInitRange()));
  reader->closeFilterGroup();
}
コード例 #4
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void CropImageGeometry::readFilterParameters(AbstractFilterParametersReader* reader, int index)
{
  reader->openFilterGroup(this, index);
  setNewDataContainerName( reader->readString("NewDataContainerName", getNewDataContainerName() ) );
  setCellAttributeMatrixPath( reader->readDataArrayPath("CellAttributeMatrixPath", getCellAttributeMatrixPath() ) );
  setCellFeatureAttributeMatrixPath( reader->readDataArrayPath("CellFeatureAttributeMatrixPath", getCellFeatureAttributeMatrixPath() ) );
  setFeatureIdsArrayPath(reader->readDataArrayPath("FeatureIdsArrayPath", getFeatureIdsArrayPath() ) );
  setXMin( reader->readValue("XMin", getXMin()) );
  setYMin( reader->readValue("YMin", getYMin()) );
  setZMin( reader->readValue("ZMin", getZMin()) );
  setXMax( reader->readValue("XMax", getXMax()) );
  setYMax( reader->readValue("YMax", getYMax()) );
  setZMax( reader->readValue("ZMax", getZMax()) );
  setRenumberFeatures( reader->readValue("RenumberFeatures", getRenumberFeatures()) );
  setSaveAsNewDataContainer( reader->readValue("SaveAsNewDataContainer", getSaveAsNewDataContainer()) );
  setUpdateOrigin( reader->readValue("UpdateOrigin", getUpdateOrigin()) );
  reader->closeFilterGroup();
}
コード例 #5
0
    void setupInitialConditions()
    {
        setParticleDimensions(2);
        setSystemDimensions(2);
        setXMin(-2.0);
        setXMax(2.0);
        setYMin(-2.0);
        setYMax(2.0);
        species->setDensity(6.0 / constants::pi);
        setGravity(Vec3D(0.0, 0.0, 0.0));
        species->setCollisionTimeAndRestitutionCoefficient(0.01, 1.0, 1.0);
        setTimeStep(0.0002);
        setTimeMax(1.0);
        setSaveCount(helpers::getSaveCountFromNumberOfSavesAndTimeMaxAndTimestep(20, getTimeMax(), getTimeStep()));

        p1f = particleHandler.copyAndAddObject(BaseParticle());
        p2f = particleHandler.copyAndAddObject(BaseParticle());
        p3f = particleHandler.copyAndAddObject(BaseParticle());
        p1e = particleHandler.copyAndAddObject(BaseParticle());
        p2e = particleHandler.copyAndAddObject(BaseParticle());
        p3e = particleHandler.copyAndAddObject(BaseParticle());
        triangle = wallHandler.copyAndAddObject(IntersectionOfWalls());
        std::vector<Vec3D> points={Vec3D(0.5,-std::sqrt(3)/6.0,0.0),Vec3D(0.0,std::sqrt(3)/3.0,0.0),Vec3D(-0.5,-std::sqrt(3)/6.0,0.0),Vec3D(0.5,-std::sqrt(3)/6.0,0.0)};
        triangle->createOpenPrism(points,Vec3D(0.0,0.0,1.0));
                        
        p1f->setRadius(0.1);
        p2f->setRadius(0.1);
        p3f->setRadius(0.1);      
        p1f->setPosition(Vec3D(-0.5, std::sqrt(3)/6.0,0.0));
        p2f->setPosition(Vec3D(-0.0,-std::sqrt(3)/3.0,0.0));
        p3f->setPosition(Vec3D( 0.5, std::sqrt(3)/6.0,0.0));
        p1f->setVelocity(Vec3D( 0.5,-std::sqrt(3)/6.0,0.0));
        p2f->setVelocity(Vec3D( 0.0, std::sqrt(3)/3.0,0.0));
        p3f->setVelocity(Vec3D(-0.5,-std::sqrt(3)/6.0,0.0));
        p1e->setRadius(0.1);
        p2e->setRadius(0.1);
        p3e->setRadius(0.1);      
        p1e->setPosition(1.5*Vec3D( 0.5,-std::sqrt(3)/6.0,0.0));
        p2e->setPosition(1.5*Vec3D( 0.0, std::sqrt(3)/3.0,0.0));
        p3e->setPosition(1.5*Vec3D(-0.5,-std::sqrt(3)/6.0,0.0));
        p1e->setVelocity(Vec3D(-0.5, std::sqrt(3)/6.0,0.0));
        p2e->setVelocity(Vec3D( 0.0,-std::sqrt(3)/3.0,0.0));
        p3e->setVelocity(Vec3D( 0.5, std::sqrt(3)/6.0,0.0));
	}
コード例 #6
0
ファイル: ComplexPlotter.cpp プロジェクト: trent2/MathTools
ComplexPlotter::ComplexPlotter(QWidget *parent) : Plotter(parent), mP(ComplexPlotter::Parameter()),
						  mRepaintEnabled(false),
						  finishCounter(0), mStopwatch(new QElapsedTimer), mMutex()
{
  mP.mF = new MFC_t;
  paintThreads = new ImageRendererThread*[MAX_THREADS];  // there's a maximum of MAX_THREADS threads allowed

  for(int i=0; i<MAX_THREADS; ++i)
    paintThreads[i] = new ImageRendererThread(i, mMutex);

  mLabel = new QLabel(this);
  mLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
  QVBoxLayout *l = new QVBoxLayout(this);
  l->setContentsMargins(0,0,0,0);
  l->addWidget(mLabel);
  setYMin(-2);
  setYMax(2);
  setXMin(-2);
  setXMax(2);
}
コード例 #7
0
	void setupInitialConditions()
	{
        relVelocity_ = 1e-1;
        setName("AdhesiveForceUnitTest_ParticleWallInteractionWithPlasticForces");

        setSystemDimensions(3);
		setParticleDimensions(3);
		setGravity(Vec3D(0,0,0));

        species->setDensity(2000.0);
        species->setStiffness(1e2);
	    species->setAdhesionStiffness(1e2);
	    species->setAdhesionForceMax(1e-5*species->getAdhesionStiffness());
	    Mdouble R = 1e-3;
        species->setSlidingStiffness(1.2e1);
        species->setSlidingFrictionCoefficient(0.01);
        setTimeStep(5e-6 / 2.0);
        
	    setXMax( 2*R);
		setYMax(   R);
		setZMax(   R);
		setXMin(0);
		setYMin(-R);
		setZMin(-R);
		
        particleHandler.clear();
		BaseParticle P;
		P.setRadius(R);
		P.setPosition(Vec3D(R+species->getInteractionDistance()*1/3,0,0));
		P.setVelocity(Vec3D(-relVelocity_/2,0,0));
		particleHandler.copyAndAddObject(P);
		
   		wallHandler.clear();
		InfiniteWall w;
		w.set(Vec3D(-1, 0, 0), Vec3D(getXMin(), 0, 0));
		wallHandler.copyAndAddObject(w);
     
		setTimeMax(getTimeStep()*250*4);
        setFileType(FileType::ONE_FILE);
		setSaveCount(1);
	}
コード例 #8
0
void BinnedMap::load(const QDomElement &e) {
    QDomNode n = e.firstChild();

    setAutoBin(false);

    while (!n.isNull()) {
        QDomElement e = n.toElement();

        if (!e.isNull()) {
            if (e.tagName() == "tag") {
                setTag(KstObjectTag::fromString(e.text()));
            } else if (e.tagName() == "ivector") {
                _inputVectorLoadQueue.append(qMakePair(e.attribute("name"), e.text()));
            } else if (e.tagName() == "omatrix") {
                KstWriteLocker blockMatrixUpdates(&KST::matrixList.lock());
                KstMatrixPtr m;

                m = new KstMatrix(KstObjectTag(e.text(), tag()), this);
                _outputMatrices.insert(e.attribute("name"), m);
            } else if (e.tagName() == "minX") {
                setXMin(e.text().toDouble());
            } else if (e.tagName() == "maxX") {
                setXMax(e.text().toDouble());
            } else if (e.tagName() == "minY") {
                setYMin(e.text().toDouble());
            } else if (e.tagName() == "maxY") {
                setYMax(e.text().toDouble());
            } else if (e.tagName() == "nX") {
                setNX(e.text().toInt());
            } else if (e.tagName() == "nY") {
                setNY(e.text().toInt());
            } else if (e.tagName() == "autoBin") {
                setAutoBin(true);
            }
        }
        n = n.nextSibling();
    }
}
コード例 #9
0
    void setupInitialConditions()
    {
        setParticleDimensions(3);
        setXMax(2);
        setYMax(2);
        setZMax(2);
        setSystemDimensions(3);
        species->setDensity(6.0 / constants::pi);
        setGravity(Vec3D(0.0, 0.0, 0.0));
        species->setCollisionTimeAndRestitutionCoefficient(0.01, 1.0, 1.0);
        setTimeStep(0.0002);
        setTimeMax(1.0);
        setSaveCount(helpers::getSaveCountFromNumberOfSavesAndTimeMaxAndTimestep(20, getTimeMax(), getTimeStep()));

        //set particles
        particle->setRadius(0.5);
        particle->setPosition(Vec3D(1.0, 1.0, 1.0));
        particle->setVelocity(Vec3D(0.0, 0.0, -1.0));

        //set walls
        wall->setNormal(Vec3D(0.0, 0.0, -1.0));

    }
コード例 #10
0
ファイル: HGridUnitTest.cpp プロジェクト: gladk/MercuryDPM
    void setupInitialConditions()
    {
        if (particleHandler.getNumberOfObjects() != N)
        {
            particleHandler.clear();
            boundaryHandler.clear();
            
            double VP = constants::pi * 4.0 / 3.0;
            L = pow(N * VP * DistInt(1, omega) / nu, 1.0 / 3.0);
            
            setXMin(0);
            setYMin(0);
            setZMin(0);
            setXMax(L);
            setYMax(L);
            setZMax(L);
            
            PeriodicBoundary b0;
            b0.set(Vec3D(1, 0, 0), getXMin(), getXMax());
            boundaryHandler.copyAndAddObject(b0);
            b0.set(Vec3D(0, 1, 0), getYMin(), getYMax());
            boundaryHandler.copyAndAddObject(b0);
            b0.set(Vec3D(0, 0, 1), getZMin(), getZMax());
            boundaryHandler.copyAndAddObject(b0);
            
            particleHandler.setStorageCapacity(2 * N);
            BaseParticle p0;
            p0.setVelocity(Vec3D(0.0, 0.0, 0.0));
            
            double V = 0;
            
            //Use at least particles with maximum and minimum size
            p0.setRadius(1.0);
            Vec3D position;
            position.Z = random.getRandomNumber(0, getZMax());
            position.Y = random.getRandomNumber(0, getYMax());
            position.X = random.getRandomNumber(0, getXMax());
            p0.setPosition(position);
            particleHandler.copyAndAddObject(p0);
            V += VP * pow(p0.getRadius(), 3);
            
            p0.setRadius(omega);
            position.Z = random.getRandomNumber(0, getZMax());
            position.Y = random.getRandomNumber(0, getYMax());
            position.X = random.getRandomNumber(0, getXMax());
            p0.setPosition(position);
            particleHandler.copyAndAddObject(p0);
            V += VP * pow(p0.getRadius(), 3);

            //For other particles use a random distribution
            for (unsigned int i = 2; i < N; i++)
            {
                p0.setRadius(RandomRadius());
                position.Z = random.getRandomNumber(0, getZMax());
                position.Y = random.getRandomNumber(0, getYMax());
                position.X = random.getRandomNumber(0, getXMax());
                p0.setPosition(position);
                particleHandler.copyAndAddObject(p0);
                V += VP * pow(p0.getRadius(), 3);
            }
        }
    }
コード例 #11
0
void BinnedMap::binnedmap() {
    KstVectorPtr x = *_inputVectors.find(VECTOR_X);
    KstVectorPtr y = *_inputVectors.find(VECTOR_Y);
    KstVectorPtr z = *_inputVectors.find(VECTOR_Z);
    KstMatrixPtr map = *_outputMatrices.find(MAP);
    KstMatrixPtr hitsMap = *_outputMatrices.find(HITSMAP);
    KstScalarPtr autobin = *_inputScalars.find(AUTOBIN);

    if (autobin) {
        if (autobin->value() != 0.0) {
            _autoBin = true;
        } else {
            _autoBin = false;
        }
    }

    if (_autoBin) {
        double minx, miny, maxx, maxy;
        int nx, ny;

        autoSize(X(), Y(), &nx, &minx, &maxx, &ny, &miny, &maxy);

        setNX(nx);
        setNY(ny);
        setXMin(minx);
        setXMax(maxx);
        setYMin(miny);
        setYMax(maxy);
    } else {
        KstScalarPtr xmin = *_inputScalars.find(XMIN);
        KstScalarPtr xmax = *_inputScalars.find(XMAX);
        KstScalarPtr ymin = *_inputScalars.find(YMIN);
        KstScalarPtr ymax = *_inputScalars.find(YMAX);
        KstScalarPtr nx = *_inputScalars.find(NX);
        KstScalarPtr ny = *_inputScalars.find(NY);

        if (xmin) {
            _xMin = xmin->value();
        }
        if (xmax) {
            _xMax = xmax->value();
        }
        if (ymin) {
            _yMin = ymin->value();
        }
        if (ymax) {
            _yMax = ymax->value();
        }
        if (nx) {
            _nx = (int)nx->value();
        }
        if (ny) {
            _ny = (int)ny->value();
        }
    }

    bool needsresize = false;

    if (_nx < 2) {
        _nx = 2;
        needsresize = true;
    }
    if (_ny < 2) {
        _ny = 2;
        needsresize = true;
    }

    if ((map->xNumSteps() != _nx) || (map->yNumSteps() != _ny) ||
            (map->minX() != _xMin) || (map->minY() != _yMin)) {
        needsresize = true;
    }

    if (map->xStepSize() != (_xMax - _xMin)/double(_nx-1)) {
        needsresize = true;
    }
    if (map->yStepSize() != (_yMax - _yMin)/double(_ny-1)) {
        needsresize = true;
    }

    if (needsresize) {
        map->change(map->tag(), _nx, _ny, _xMin, _yMin,
                    (_xMax - _xMin)/double(_nx-1), (_yMax - _yMin)/double(_ny-1));
        map->resize(_nx, _ny);
        hitsMap->change(hitsMap->tag(), _nx, _ny, _xMin, _yMin,
                        (_xMax - _xMin)/double(_nx-1), (_yMax - _yMin)/double(_ny-1));
        hitsMap->resize(_nx, _ny);
    }

    map->zero();
    hitsMap->zero();

    int ns = z->length(); // the z vector defines the number of points.
    double n,p, x0, y0, z0;

    for (int i=0; i<ns; i++) {
        x0 = x->interpolate(i, ns);
        y0 = y->interpolate(i, ns);
        z0 = z->interpolate(i, ns);
        p = map->value(x0, y0)+z0;
        map->setValue(x0, y0, p);
        n = hitsMap->value(x0, y0)+1;
        hitsMap->setValue(x0, y0, n);
    }

    for (int i=0; i<_nx; i++) {
        for (int j=0; j<_ny; j++) {
            p = map->valueRaw(i, j);
            n = hitsMap->valueRaw(i, j);
            if (n>0) {
                map->setValueRaw(i, j, p/n);
            } else {
                map->setValueRaw(i, j, KST::NOPOINT);
            }
        }
    }
}
コード例 #12
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void CropImageGeometry::dataCheck()
{
  if(getErrorCondition() < 0) { return; }
  setErrorCondition(0);

  // Validate the incoming DataContainer, Geometry, and AttributeMatrix ; bail if any do not exist since we plan on using them later on in the dataCheck
  // Error messages are handled by the getPrereq functions
  DataContainer::Pointer srcCellDataContainer = getDataContainerArray()->getPrereqDataContainer<AbstractFilter>(this, getCellAttributeMatrixPath().getDataContainerName());
  ImageGeom::Pointer image = getDataContainerArray()->getPrereqGeometryFromDataContainer<ImageGeom, AbstractFilter>(this, getCellAttributeMatrixPath().getDataContainerName());
  AttributeMatrix::Pointer srcCellAttrMat = getDataContainerArray()->getPrereqAttributeMatrixFromPath<AbstractFilter>(this, getCellAttributeMatrixPath(), -301);
  if(getErrorCondition() < 0) { return; }

  DataContainer::Pointer destCellDataContainer = srcCellDataContainer;
  AttributeMatrix::Pointer destCellAttrMat;

  if (m_SaveAsNewDataContainer == true)
  {
    float ox = 0.0f, oy = 0.0f, oz = 0.0f, rx = 0.0f, ry = 0.0f, rz = 0.0f;
    size_t dx = 0, dy = 0, dz = 0;
    image->getOrigin(ox, oy, oz);
    image->getResolution(rx, ry, rz);
    image->getDimensions(dx, dy, dz);

    destCellDataContainer = getDataContainerArray()->createNonPrereqDataContainer<AbstractFilter>(this, getNewDataContainerName());
    if(NULL == destCellDataContainer.get() || getErrorCondition() < 0)
    {
      return;
    }
    IGeometry::Pointer imageCopy = image->deepCopy();
    destCellDataContainer->setGeometry(imageCopy);

    destCellAttrMat = srcCellAttrMat->deepCopy();
    destCellDataContainer->addAttributeMatrix(destCellAttrMat->getName(), destCellAttrMat);
  }
  else
  {
    destCellAttrMat = srcCellAttrMat;
  }

  if(NULL == destCellDataContainer.get() || NULL == destCellAttrMat.get() || getErrorCondition() < 0)
  {
    return;
  }

  if (getXMax() < getXMin())
  {
    QString ss = QObject::tr("X Max (%1) less than X Min (%2)").arg(getXMax()).arg(getXMin());
    notifyErrorMessage(getHumanLabel(), ss, -5550);
    setErrorCondition(-5550);
  }
  if (getYMax() < getYMin())
  {
    QString ss = QObject::tr("Y Max (%1) less than Y Min (%2)").arg(getYMax()).arg(getYMin());
    notifyErrorMessage(getHumanLabel(), ss, -5550);
    setErrorCondition(-5550);
  }
  if (getZMax() < getZMin())
  {
    QString ss = QObject::tr("Z Max (%1) less than Z Min (%2)").arg(getZMax()).arg(getZMin());
    notifyErrorMessage(getHumanLabel(), ss, -5550);
    setErrorCondition(-5550);
  }
  if (getXMin() < 0)
  {
    QString ss = QObject::tr("X Min (%1) less than 0").arg(getXMin());
    notifyErrorMessage(getHumanLabel(), ss, -5550);
    setErrorCondition(-5550);
  }
  if (getYMin() < 0)
  {
    QString ss = QObject::tr("Y Min (%1) less than 0").arg(getYMin());
    notifyErrorMessage(getHumanLabel(), ss, -5550);
    setErrorCondition(-5550);
  }
  if (getZMin() < 0)
  {
    QString ss = QObject::tr("Z Min (%1) less than 0").arg(getZMin());
    notifyErrorMessage(getHumanLabel(), ss, -5550);
    setErrorCondition(-5550);
  }

  if (getXMax() > (static_cast<int64_t>(destCellDataContainer->getGeometryAs<ImageGeom>()->getXPoints()) - 1))
  {
    QString ss = QObject::tr("The X Max (%1) is greater than the Image Geometry X extent (%2)").arg(getXMax()).arg(static_cast<int64_t>(destCellDataContainer->getGeometryAs<ImageGeom>()->getXPoints()) - 1);
    notifyErrorMessage(getHumanLabel(), ss, -5550);
    setErrorCondition(-5550);
  }

  if (getYMax() > (static_cast<int64_t>(destCellDataContainer->getGeometryAs<ImageGeom>()->getYPoints()) - 1))
  {
    QString ss = QObject::tr("The Y Max (%1) is greater than the Image Geometry Y extent (%2)").arg(getYMax()).arg(static_cast<int64_t>(destCellDataContainer->getGeometryAs<ImageGeom>()->getYPoints()) - 1);
    notifyErrorMessage(getHumanLabel(), ss, -5550);
    setErrorCondition(-5550);
  }

  if (getZMax() > (static_cast<int64_t>(destCellDataContainer->getGeometryAs<ImageGeom>()->getZPoints()) - 1))
  {
    QString ss = QObject::tr("The Z Max (%1) is greater than the Image Geometry Z extent (%2)").arg(getZMax()).arg(static_cast<int64_t>(destCellDataContainer->getGeometryAs<ImageGeom>()->getZPoints()) - 1);
    notifyErrorMessage(getHumanLabel(), ss, -5550);
    setErrorCondition(-5550);
  }

  QVector<size_t> tDims(3, 0);
  if (getXMax() - getXMin() < 0) { setXMax(getXMin() + 1); }
  if (getYMax() - getYMin() < 0) { setYMax(getYMin() + 1); }
  if (getZMax() - getZMin() < 0) { setZMax(getZMin() + 1); }
  tDims[0] = (getXMax() - getXMin()) + 1;
  tDims[1] = (getYMax() - getYMin()) + 1;
  tDims[2] = (getZMax() - getZMin()) + 1;

  destCellDataContainer->getGeometryAs<ImageGeom>()->setDimensions(tDims[0], tDims[1], tDims[2]);

  // If any of the sanity checks fail above then we should NOT attempt to go any further.
  if (getErrorCondition() < 0) { return; }

  size_t totalPoints = 1;
  for(int i = 0; i < 3; i++) {
    if(tDims[i] != 0) { totalPoints *= tDims[i]; }
  }
  AttributeMatrix::Pointer newCellAttrMat = AttributeMatrix::New(tDims, destCellAttrMat->getName(), destCellAttrMat->getType());

  QList<QString> voxelArrayNames = destCellAttrMat->getAttributeArrayNames();
  for (QList<QString>::iterator iter = voxelArrayNames.begin(); iter != voxelArrayNames.end(); ++iter)
  {
    IDataArray::Pointer p = destCellAttrMat->getAttributeArray(*iter);
    //
    IDataArray::Pointer data = p->createNewArray(totalPoints, p->getComponentDimensions(), p->getName(), false);

    destCellAttrMat->removeAttributeArray(*iter);
    newCellAttrMat->addAttributeArray(*iter, data);
  }
  destCellDataContainer->removeAttributeMatrix(destCellAttrMat->getName());
  destCellDataContainer->addAttributeMatrix(newCellAttrMat->getName(), newCellAttrMat);


  if(m_RenumberFeatures == true)
  {
    QVector<size_t> cDims(1, 1);
    m_FeatureIdsPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<int32_t>, AbstractFilter>(this, getFeatureIdsArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
    if( NULL != m_FeatureIdsPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
    {
      m_FeatureIds = m_FeatureIdsPtr.lock()->getPointer(0);
    } /* Now assign the raw pointer to data from the DataArray<T> object */

    AttributeMatrix::Pointer cellFeatureAttrMat = srcCellDataContainer->getAttributeMatrix(getCellFeatureAttributeMatrixPath().getAttributeMatrixName());
    if(NULL == cellFeatureAttrMat.get()) { return; }
    QVector<bool> activeObjects(cellFeatureAttrMat->getNumTuples(), true);
    cellFeatureAttrMat->removeInactiveObjects(activeObjects, m_FeatureIdsPtr.lock());
  }
}
コード例 #13
0
    void setupInitialConditions()
    {
        auto species = speciesHandler.copyAndAddObject(LinearViscoelasticFrictionSpecies());
        species->setDensity(constants::pi / 6.0);

        double stiffness = 1e5;
        setParticleDimensions(2);
        species->setDensity(2500);
        species->setStiffness(stiffness);
        species->setSlidingStiffness(2.0 / 7.0 * stiffness);
	species->setSlidingFrictionCoefficient(0.5);
        species->setRollingStiffness(2.0 / 5.0 * stiffness);
        species->setRollingFrictionCoefficient(0.5);
        species->setTorsionStiffness(2.0 / 5.0 * stiffness);
        species->setTorsionFrictionCoefficient(0.5);

        setGravity(Vec3D(0.0, 0.0, 0.0));
        setTimeMax(8e-2);
        setTimeStep(2.0e-4);
        setFileType(FileType::NO_FILE);

        setXMin(0.0);
        setYMin(0.0);
        setXMax(1.0);
        setYMax(1.0);

        PeriodicBoundary b0;
        b0.set(Vec3D(1, 0, 0), getXMin(), getXMax());
        boundaryHandler.copyAndAddObject(b0);
        b0.set(Vec3D(0, 1, 0), getYMin(), getYMax());
        boundaryHandler.copyAndAddObject(b0);

        BaseParticle P0, P1, P2, P3, P4, P5, P6, P7;

        //Particle to be removed
        P0.setPosition(Vec3D(0.1, 0.1, 0.0));
        P1.setPosition(Vec3D(0.3, 0.3, 0.0));
        //Contacts starts normal becomes periodic
        P2.setPosition(Vec3D(0.6, 0.041, 0.0));
        P2.setAngularVelocity(Vec3D(0.3, 0.6, 0.9));
        P3.setPosition(Vec3D(0.4, 0.001, 0.0));
        //Normal case
        P4.setPosition(Vec3D(0.6, 0.82, 0.0));
        P4.setAngularVelocity(Vec3D(0.3, 0.6, 0.9));
        P5.setPosition(Vec3D(0.4, 0.78, 0.0));
        //Contact starts periodic becomes normal and periodic again
        P6.setPosition(Vec3D(0.02, 0.42, 0.0));
        P6.setAngularVelocity(Vec3D(0.3, 0.6, 0.9));
        P7.setPosition(Vec3D(0.82, 0.38, 0.0));

        P0.setVelocity(Vec3D(0.0, 0.0, 0.0));
        P1.setVelocity(Vec3D(0.0, 0.0, 0.0));
        P2.setVelocity(Vec3D(-1.0, 0.0, 0.0));
        P3.setVelocity(Vec3D(1.0, 0.0, 0.0));
        P4.setVelocity(Vec3D(-1.0, 0.0, 0.0));
        P5.setVelocity(Vec3D(1.0, 0.0, 0.0));
        P6.setVelocity(Vec3D(-1.0, 0.0, 0.0));
        P7.setVelocity(Vec3D(1.0, 0.0, 0.0));

        P0.setRadius(0.1);
        P1.setRadius(0.1);
        P2.setRadius(0.1);
        P3.setRadius(0.1);
        P4.setRadius(0.1);
        P5.setRadius(0.1);
        P6.setRadius(0.1);
        P7.setRadius(0.1);

        particleHandler.copyAndAddObject(P0);
        particleHandler.copyAndAddObject(P1);
        particleHandler.copyAndAddObject(P2);
        particleHandler.copyAndAddObject(P3);
        particleHandler.copyAndAddObject(P4);
        particleHandler.copyAndAddObject(P5);
        particleHandler.copyAndAddObject(P6);
        particleHandler.copyAndAddObject(P7);
    }