[cig-commits] commit: Allow a static side to have a time-dependent position.
Mercurial
hg at geodynamics.org
Wed Apr 18 00:31:30 PDT 2012
changeset: 929:d54e97f15481
tag: tip
user: Walter Landry <wlandry at caltech.edu>
date: Wed Apr 18 00:31:14 2012 -0700
files: plugins/EulerDeform/Context.h plugins/EulerDeform/EulerDeform.h plugins/EulerDeform/EulerDeform_Build.cxx plugins/EulerDeform/EulerDeform_Remesh.cxx plugins/EulerDeform/EulerDeform_Remesh_Corner.cxx
description:
Allow a static side to have a time-dependent position.
diff -r 55d11f4bbc42 -r d54e97f15481 plugins/EulerDeform/Context.h
--- a/plugins/EulerDeform/Context.h Wed Apr 18 00:30:22 2012 -0700
+++ b/plugins/EulerDeform/Context.h Wed Apr 18 00:31:14 2012 -0700
@@ -88,6 +88,10 @@
double static_left_coord;
double static_front_coord;
double static_back_coord;
+ char* static_right_equation;
+ char* static_left_equation;
+ char* static_front_equation;
+ char* static_back_equation;
};
#endif
diff -r 55d11f4bbc42 -r d54e97f15481 plugins/EulerDeform/EulerDeform.h
--- a/plugins/EulerDeform/EulerDeform.h Wed Apr 18 00:30:22 2012 -0700
+++ b/plugins/EulerDeform/EulerDeform.h Wed Apr 18 00:31:14 2012 -0700
@@ -63,7 +63,9 @@
Bool _EulerDeform_LineInterp(double** crds, const double &pnt,
unsigned fromDim, unsigned toDim, double* val);
void EulerDeform_Remesh(TimeIntegrand* crdAdvector, EulerDeform_Context* edCtx);
- void EulerDeform_Remesh_Corner(Mesh *mesh, const int &corner, const int &inside,
+ void EulerDeform_Remesh_Corner(Mesh *mesh, EulerDeform_Context* edCtx,
+ const int &corner, const int &inside,
+ const char* side_eqn,
const double &side_coord, const int &boundary_dim,
const int &height_dim, const int &tangent_dim);
void EulerDeform_WrapSurface(EulerDeform_System* sys,double** oldCrds,
diff -r 55d11f4bbc42 -r d54e97f15481 plugins/EulerDeform/EulerDeform_Build.cxx
--- a/plugins/EulerDeform/EulerDeform_Build.cxx Wed Apr 18 00:30:22 2012 -0700
+++ b/plugins/EulerDeform/EulerDeform_Build.cxx Wed Apr 18 00:31:14 2012 -0700
@@ -306,25 +306,37 @@ void EulerDeform_Build(void* component,
/* TODO: fix to allow equations */
- if(sys->staticRight && sys->wrapTop
- && !sys->staticRightTop)
- sys->static_right_coord =
- Dictionary_GetDouble( uwCtx->dictionary, "maxX");
+ sys->static_right_equation=
+ Dictionary_GetString_WithDefault(sysDict,"right_equation","");
+ if(strlen(sys->static_right_equation)==0)
+ {
+ sys->static_right_coord =
+ Dictionary_GetDouble( uwCtx->dictionary, "maxX");
+ }
- if(sys->staticLeft && sys->wrapTop
- && !sys->staticLeftTop)
- sys->static_left_coord =
- Dictionary_GetDouble( uwCtx->dictionary, "minX");
+ sys->static_left_equation=
+ Dictionary_GetString_WithDefault(sysDict,"left_equation","");
+ if(strlen(sys->static_left_equation)==0)
+ {
+ sys->static_left_coord =
+ Dictionary_GetDouble( uwCtx->dictionary, "minX");
+ }
- if(sys->staticBack && sys->wrapTop
- && !sys->staticTopBack)
- sys->static_back_coord =
- Dictionary_GetDouble( uwCtx->dictionary, "minZ");
+ sys->static_back_equation=
+ Dictionary_GetString_WithDefault(sysDict,"back_equation","");
+ if(strlen(sys->static_back_equation)==0)
+ {
+ sys->static_back_coord =
+ Dictionary_GetDouble( uwCtx->dictionary, "minZ");
+ }
- if(sys->staticFront && sys->wrapTop
- && !sys->staticTopFront)
- sys->static_front_coord =
- Dictionary_GetDouble( uwCtx->dictionary, "maxZ");
+ sys->static_front_equation=
+ Dictionary_GetString_WithDefault(sysDict,"front_equation","");
+ if(strlen(sys->static_front_equation)==0)
+ {
+ sys->static_front_coord =
+ Dictionary_GetDouble( uwCtx->dictionary, "maxZ");
+ }
}
}
diff -r 55d11f4bbc42 -r d54e97f15481 plugins/EulerDeform/EulerDeform_Remesh.cxx
--- a/plugins/EulerDeform/EulerDeform_Remesh.cxx Wed Apr 18 00:30:22 2012 -0700
+++ b/plugins/EulerDeform/EulerDeform_Remesh.cxx Wed Apr 18 00:31:14 2012 -0700
@@ -43,6 +43,17 @@
#include "types.h"
#include "Context.h"
#include "EulerDeform.h"
+
+inline void set_vert(const int &d, const unsigned int &boundary, double *vert,
+ IJK ijk, const char* eqn, EulerDeform_Context* edCtx)
+{
+ if(ijk[d]==boundary && strlen(eqn)!=0)
+ {
+ vert[d]=Equation_eval(vert,
+ reinterpret_cast<DomainContext*>(edCtx->ctx),
+ eqn);
+ }
+}
void EulerDeform_Remesh(TimeIntegrand* crdAdvector, EulerDeform_Context* edCtx)
{
@@ -116,26 +127,61 @@ void EulerDeform_Remesh(TimeIntegrand* c
{
if(sys->staticLeft && !sys->staticLeftTop && !sys->floatLeftTop)
{
- EulerDeform_Remesh_Corner(sys->mesh,0,1,sys->static_left_coord,
+ EulerDeform_Remesh_Corner(sys->mesh,edCtx,0,1,
+ sys->static_left_equation,
+ sys->static_left_coord,
0,1,2);
}
if(sys->staticRight && !sys->staticRightTop && !sys->floatRightTop)
{
- EulerDeform_Remesh_Corner(sys->mesh,grid->sizes[0]-1,
+ EulerDeform_Remesh_Corner(sys->mesh,edCtx,grid->sizes[0]-1,
grid->sizes[0]-2,
+ sys->static_right_equation,
sys->static_right_coord,0,1,2);
+ }
+ if(sys->staticBack && !sys->staticTopBack)
+ {
+ EulerDeform_Remesh_Corner(sys->mesh,edCtx,0,1,
+ sys->static_back_equation,
+ sys->static_back_coord,2,1,0);
}
if(sys->staticFront && !sys->staticTopFront)
{
- EulerDeform_Remesh_Corner(sys->mesh,grid->sizes[2]-1,
- grid->sizes[2]-2,sys->static_front_coord,2,1,0);
- }
- if(sys->staticBack && !sys->staticTopBack)
- {
- EulerDeform_Remesh_Corner(sys->mesh,0,1,sys->static_back_coord,2,1,0);
+ EulerDeform_Remesh_Corner(sys->mesh,edCtx,grid->sizes[2]-1,
+ grid->sizes[2]-2,
+ sys->static_front_equation,
+ sys->static_front_coord,2,1,0);
}
}
+
+ if((sys->static_left_equation!=NULL
+ && strlen(sys->static_left_equation)!=0)
+ || (sys->static_right_equation!=NULL
+ && strlen(sys->static_right_equation)!=0)
+ || (sys->static_front_equation!=NULL
+ && strlen(sys->static_front_equation)!=0)
+ || (sys->static_back_equation!=NULL
+ && strlen(sys->static_back_equation)!=0))
+ {
+ IJK ijk;
+ unsigned nNodes = Mesh_GetDomainSize( sys->mesh, MT_VERTEX );
+ for(unsigned n_i = 0; n_i < nNodes; n_i++ )
+ {
+ RegularMeshUtils_Node_1DTo3D
+ (sys->mesh,
+ Mesh_DomainToGlobal(sys->mesh,MT_VERTEX,n_i),ijk);
+
+ set_vert(0,0,sys->mesh->verts[n_i],ijk,
+ sys->static_left_equation,edCtx);
+ set_vert(0,grid->sizes[0]-1,sys->mesh->verts[n_i],ijk,
+ sys->static_right_equation,edCtx);
+ set_vert(2,0,sys->mesh->verts[n_i],ijk,
+ sys->static_back_equation,edCtx);
+ set_vert(2,grid->sizes[2]-1,sys->mesh->verts[n_i],ijk,
+ sys->static_front_equation,edCtx);
+ }
+ }
}
/* If we have regular mesh algorithms specified, set the
diff -r 55d11f4bbc42 -r d54e97f15481 plugins/EulerDeform/EulerDeform_Remesh_Corner.cxx
--- a/plugins/EulerDeform/EulerDeform_Remesh_Corner.cxx Wed Apr 18 00:30:22 2012 -0700
+++ b/plugins/EulerDeform/EulerDeform_Remesh_Corner.cxx Wed Apr 18 00:31:14 2012 -0700
@@ -46,7 +46,9 @@
/* Remesh the top corners in 2D or 3D */
-void EulerDeform_Remesh_Corner(Mesh *mesh, const int &corner, const int &inside,
+void EulerDeform_Remesh_Corner(Mesh *mesh, EulerDeform_Context* edCtx,
+ const int &corner, const int &inside,
+ const char* side_eqn,
const double &side_coord, const int &boundary_dim,
const int &height_dim, const int &tangent_dim)
{
@@ -73,15 +75,23 @@ void EulerDeform_Remesh_Corner(Mesh *mes
crds[0]=mesh->verts[n];
crds[1]=mesh->verts[n_in];
- if(!_EulerDeform_LineInterp(crds,side_coord,boundary_dim,height_dim,
+ double coord=side_coord;
+ if(side_eqn!=NULL && strlen(side_eqn)!=0)
+ {
+ coord=Equation_eval(crds[0],
+ reinterpret_cast<DomainContext*>(edCtx->ctx),
+ side_eqn,true);
+ }
+
+ if(!_EulerDeform_LineInterp(crds,coord,boundary_dim,height_dim,
&(mesh->verts[n][height_dim])))
{
printf("The side is moving in the wrong direction.\n");
- printf("%g %g %g %g %g\n",side_coord,crds[0][0],crds[0][1],
+ printf("%g %g %g %g %g\n",coord,crds[0][0],crds[0][1],
crds[1][0],crds[1][1]);
abort();
}
- mesh->verts[n][boundary_dim]=side_coord;
+ mesh->verts[n][boundary_dim]=coord;
}
}
else /* 3D */
@@ -99,18 +109,25 @@ void EulerDeform_Remesh_Corner(Mesh *mes
double *crds[2];
crds[0]=mesh->verts[n];
crds[1]=mesh->verts[n_in];
+ double coord=side_coord;
+ if(strlen(side_eqn)!=0)
+ {
+ coord=Equation_eval(crds[0],
+ reinterpret_cast<DomainContext*>(edCtx->ctx),
+ side_eqn,true);
+ }
- if(!_EulerDeform_LineInterp(crds,side_coord,boundary_dim,
+ if(!_EulerDeform_LineInterp(crds,coord,boundary_dim,
height_dim,
&(mesh->verts[n][height_dim])))
{
printf("The side is moving in the wrong direction.\n");
- printf("%g %g %g %g %g %g %g\n",side_coord,crds[0][0],
+ printf("%g %g %g %g %g %g %g\n",coord,crds[0][0],
crds[0][1],crds[0][2],crds[1][0],crds[1][1],
crds[1][2]);
abort();
}
- mesh->verts[n][boundary_dim]=side_coord;
+ mesh->verts[n][boundary_dim]=coord;
}
}
}
More information about the CIG-COMMITS
mailing list