// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- 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(); }
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); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- 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(); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- 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(); }
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)); }
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); }
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); }
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(); } }
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); } } }
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); } } } }
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); }