Commit 51355c7a authored by Kirill Terekhov's avatar Kirill Terekhov

Option to refine mesh to boundary in GridTools/Sector

parent 1cf80324
......@@ -10,7 +10,7 @@ int main(int argc, char ** argv)
{
if( argc < 2 )
{
printf("Usage: %s input_mesh [rotation_angle=0 degrees] [output_mesh]\n",argv[0]);
printf("Usage: %s input_mesh [rotation_angle=0 degrees] [refine_boundary=1] [output_mesh]\n",argv[0]);
return -1;
}
......@@ -19,7 +19,9 @@ int main(int argc, char ** argv)
const double pi = 3.1415926536;
double theta = 0, ct, st;
int refine = 1;
if( argc > 2 ) theta = atof(argv[2])/180.0*pi;
if( argc > 3 ) refine = atoi(argv[3]);
ct = cos(theta);
st = sin(theta);
......@@ -39,6 +41,16 @@ int main(int argc, char ** argv)
std::cout << "x: " << xmin << ":" << xmax << std::endl;
std::cout << "y: " << ymin << ":" << ymax << std::endl;
if( refine )
{
for(Mesh::iteratorNode n = m.BeginNode(); n != m.EndNode(); ++n)
{
double a = (n->Coords()[0]-xmin)/(xmax-xmin);
a = sin(3.14159265359*a/2.0);
n->Coords()[0] = (xmax-xmin)*a + xmin;
}
}
for(Mesh::iteratorNode n = m.BeginNode(); n != m.EndNode(); ++n)
{
double x = n->Coords()[0], mx = x;
......@@ -66,10 +78,12 @@ int main(int argc, char ** argv)
std::cout << "x: " << xmin << ":" << xmax << std::endl;
std::cout << "y: " << ymin << ":" << ymax << std::endl;
if( argc > 3 )
if( argc > 4 )
{
std::cout << "Save to " << argv[3] << std::endl;
m.Save(argv[3]);
std::cout << "Save to " << argv[4] << std::endl;
m.Save(argv[4]);
}
else
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment