Esempio n. 1
0
Foam::Cloud<ParticleType>::Cloud
(
    const polyMesh& pMesh,
    const word& cloudName,
    const IDLList<ParticleType>& particles
)
:
    cloud(pMesh, cloudName),
    IDLList<ParticleType>(),
    polyMesh_(pMesh),
    globalPositionsPtr_()
{
    checkPatches();

    // Ask for the tetBasePtIs and oldCellCentres to trigger all processors to
    // build them, otherwise, if some processors have no particles then there
    // is a comms mismatch.
    polyMesh_.tetBasePtIs();
    polyMesh_.oldCellCentres();

    if (particles.size())
    {
        IDLList<ParticleType>::operator=(particles);
    }
}
Esempio n. 2
0
Foam::Cloud<ParticleType>::Cloud
(
    const polyMesh& pMesh,
    const word& cloudName,
    const IDLList<ParticleType>& particles
)
:
    cloud(pMesh, cloudName),
    IDLList<ParticleType>(),
    polyMesh_(pMesh),
    labels_(),
    nTrackingRescues_(),
    cellWallFacesPtr_()
{
    checkPatches();

    // Ask for the tetBasePtIs to trigger all processors to build
    // them, otherwise, if some processors have no particles then
    // there is a comms mismatch.
    polyMesh_.tetBasePtIs();

    if (particles.size())
    {
        IDLList<ParticleType>::operator=(particles);
    }
}
Esempio n. 3
0
int main(int argc, char *argv[]) {
	if (argc != 4) { 
		std::cout << argv[0] << "input.m patchnum sampling\n";
		exit(-1);
	}
	
	int patchnum = atoi(argv[2]);
	double threshold = atof(argv[3]);
	srand (static_cast <unsigned> (time(0)));

	//load seeds;
	std::vector<Patch*> patches;
	//loadSeeds("seed_sim.m", patches);
	//loadSeeds("seed2.m", patches);

	Mesh *mesh = new Mesh;
	mesh->readMFile(argv[1]);

	generateSeeds(mesh, patches, patchnum);
	
	for (int i = 0; i <= 500; ++i) {
		/*if (i % 100 == 0) {
			sprintf_s(buf, "center_%d.cm", i+1);
			saveCenters(buf, patches);
		}*/
		clustering(mesh, patches);
		checkPatches(patches);
		update(patches);
		/*if (i % 100 == 0) {
			sprintf_s(buf, "out_%d.m", i+1);
			mesh->writeMFile(buf);
		}*/
		
	}
	mesh->writeMFile("end.m");
	std::cout << "end!\n";
	traceBoundary(patches);
	DualGraph *dualGraph = generateGraph(patches);

	sampling(patches, avg_length);

	delete dualGraph;
	delete mesh;
	return 0;
}