Example #1
0
void Grid::print_points() const {

	// check indexing:
	if (!check()) {
		print_labels();
		return;
	}

	for (unsigned int i = 0; i < gridSize(); i++) {

		// get index set:
		MultiIndexed::IndexSet is = i2x(i);

		// get Cartesian point:
		COORD_CART cp = getPoint(is);

		cout << "i = " << i << " --> ";
		for (unsigned int j = 0; j < cp.size(); j++) {
			cout << "x(" << j << ") = " << cp[j] << "  ";
		}

		cout << endl;
	}

}
Example #2
0
COORD_CYL coord_xyz2rpz(const COORD_CART & p){

	// reserve storage:
	COORD_CYL out(p);

	// calc r:
	out.resize(2,0);
	out[0] = eucDistCart(out,COORD_CART(2,0));

	// calc phi:
	if(out[0] == 0)
		out[1] = TWOPI/4.;
	else
		out[1] = acos(p[1]/out[0]);

	// append further coordinates:
	while(p.size() > out.size())
		out.push_back(p[out.size()]);

	return out;
}