예제 #1
0
poly_t *PolyAllocator::alloc( int numverts, int numelems )
{
	size_t size;

	size = sizeForPolyData( numverts, numelems ) + sizeof( poly_t );
	unsigned char *base = __newa__( unsigned char, size );

	poly_t *poly = ( poly_t * )base;
	poly->numverts = numverts;
	assignPointers( poly, base + sizeof( poly_t ) );
	return poly;
}
예제 #2
0
int main (int argc, char *argv[])
{
	char *configFile = NULL;
	char *outputFile = NULL;

	// Declare objects
	struct system System;
	struct tip Tip;
	struct space Space;
	struct graphene Graphene;
	struct substrate Substrate;

	initSystem(&System, &Tip, &Space, &Graphene, &Substrate);
	parseOptions(argc, argv, &configFile, &outputFile, &System, &Tip);
	parseFile(configFile, &System, &Tip, &Space, &Graphene, &Substrate);

	createSystem(&System, &Tip);
	createGraphene(&System, &Graphene);
//	transformCylindric(&System);
//	createSpace(&System, &Space);
	createTip(&System, &Tip);
	createSubstrate(&System, &Substrate);

	// Spheroidal Tip
	assignPointers(&System, &Tip, &Space, &Graphene, &Substrate);
	assignPotential(&System, &Tip, &Space, &Graphene, &Substrate);

	laplaceSpheroidal(&System, &Tip);

	retransformSpheroidal(&Tip);
	retransformCylindric(&System);

	saveData(outputFile, &System);

	// Visualize System if necessary
	if (System.visual)
	{
		initVisual();
		drawObjects(&System, &Tip, &Space, &Graphene, &Substrate);
	}

	free(System.points); // Free all points

	return EXIT_SUCCESS;
}
예제 #3
0
poly_t *PolyAllocator::get_temp( int numverts, int numelems )
{
	size_t newsize;

	newsize = sizeForPolyData( numverts, numelems );
	if( size_temp < newsize || !base_temp )
	{
		if( base_temp != 0 ) {
			__delete__( base_temp );
		}

		base_temp = __newa__( unsigned char, newsize );
		size_temp = newsize;
	}

	poly_temp.numverts = numverts;
	assignPointers( &poly_temp, base_temp );
	return &poly_temp;
}