next up previous contents
Next: L'algorithme employé Up: Un nouveau mailleur Previous: Mots clefs du fichier

Conversion du premier vers le second trianguleur

class frontiere {
public:
  float *xy;            // cordinates (for point i, x in 2*i , y in 2*i+1)
  int *ng;              // boundary number for each point
  int nbp;              // number of boundary points
  long *s;              // edges (edge i: beginning in 2*i, end in 2*i +1)
  long nbs;             // number of edges
  long nbsd;            // number of each connected component
  long *sd;             // an edge for each connected component
  float *hh;            // weight of points (to insert inner points)
  frontiere() {nbp = nbs = nbsd = 0; sd = new long[50];}
  int ajoute_point(float x, float y, int ng);
  void ajoute_segment(int n1, int n2);
  void save(const char* filename) const; //OP 97
};

void frontiere::save(const char * filename) const
{	int i;
	ofstream file(filename);
	assert(!file.fail());
	file << "MeshVersion  0 \r Dimension 2 \r MaximalAngleOfCorner 360"<< endl;
	file<<endl;
	
	file << "Vertices " << nbp << endl;
	for(i = 0; i< nbp; i++)
		file << xy[2*i] <<'\t'<< xy[2*i+1] <<'\t'<< ng[i] << endl;
	file<<endl;

	file << "Edges " << nbs << endl;
	for(i = 0; i< nbs; i++)
		file << s[2*i]+1 <<'\t'<< s[2*i+1]+1 <<'\t'<< ng[i] << endl;
	file<<endl;

	file << "SubDomain " << nbsd << endl;
	for(i = 0; i<nbsd ; i++)
		file << "2\t" << sd[2*i]+1 << "\t1\t"<< i+1 << endl;
	file<<endl;

	file << "Corners " << nbp << endl;
	for(i = 0; i< nbp; i++)
		file << i+1 << endl;
	file<<endl;
	
	file << "End" << endl;
	file.close();
}



Olivier Pironneau
Mon May 17 17:14:42 METDST 1999