Commit de73d793 authored by Robert Maynard's avatar Robert Maynard

update multi scale to generate points on the curve section.

parent 14aca243
......@@ -73,6 +73,47 @@ public:
}
};
//----------------------------------------------------------------------------
class ExtractPoints : public smtk::mesh::CellForEach
{
public:
smtk::mesh::HandleRange points;
ExtractPoints( ) :
smtk::mesh::CellForEach()
{
}
//--------------------------------------------------------------------------
void operator()(int numPts,
const smtk::mesh::Handle* const pointIds,
const double* const coords)
{
if(numPts == 4)
{
const double* const firstPoint = &coords[0];
const double* const secondPoint = &coords[3];
const double* const thirdPoint = &coords[6];
double vec1[3] = { secondPoint[0] - firstPoint[0],
secondPoint[1] - firstPoint[1],
secondPoint[2] - firstPoint[2]};
double vec2[3] = { thirdPoint[0] - firstPoint[0],
thirdPoint[1] - firstPoint[1],
thirdPoint[2] - firstPoint[2]};
if(vec1[1] == vec2[1] && vec2[1] > 0)
{
points.insert(pointIds[0]);
points.insert(pointIds[1]);
points.insert(pointIds[2]);
points.insert(pointIds[3]);
}
}
}
};
//----------------------------------------------------------------------------
void labelShellWithMaterial(const smtk::mesh::CollectionPtr& c,
const smtk::mesh::MeshSet& shell)
......@@ -106,7 +147,7 @@ bool labelIntersection(const smtk::mesh::CollectionPtr& c,
const smtk::mesh::MeshSet& shell,
double value)
{
static int nextDirId = 0;
static int nextDirId = 7;
//need to removing the verts cells from the query for now
//todo: filter needs to support vert cells
smtk::mesh::CellSet shellCells = shell.cells( );
......@@ -216,12 +257,36 @@ void extractMaterials(smtk::mesh::CollectionPtr c, std::string outputFile, doubl
const double ymax = bounds[3];
labelIntersection(c, shell, ymin);
labelIntersection(c, shell, ymax);
//now that the labelling has happend we need to extract everything in material 2
//that is in a shell, but not in any Dirichlet set.
smtk::mesh::MeshSet mat2 = c->meshes( smtk::mesh::Material(2) );
smtk::mesh::MeshSet dirs = c->meshes( smtk::mesh::Dirichlet(7) );
dirs.append( c->meshes( smtk::mesh::Dirichlet(8)) );
dirs.append( c->meshes( smtk::mesh::Dirichlet(9)) );
dirs.append( c->meshes( smtk::mesh::Dirichlet(10)) );
smtk::mesh::CellSet contactCells = smtk::mesh::point_intersect(mat2.cells(),
shell.cells(),
smtk::mesh::FullyContained);
//extract all the points for material 2
ExtractPoints filter;
smtk::mesh::for_each(contactCells ,filter);
smtk::mesh::CellSet contactPoints = smtk::mesh::CellSet(c, filter.points);
smtk::mesh::CellSet backOfShell = smtk::mesh::point_difference(dirs.cells(),
contactPoints,
smtk::mesh::FullyContained);
smtk::mesh::MeshSet contact = c->createMesh( backOfShell );
c->setDirichletOnMeshes(contact, smtk::mesh::Dirichlet( 11 ) );
}
//take all meshes that have a material, and break them into a mesh per
//cell type. This is required since a block in exodus must be of
//a single cell type
breakMaterialsByCellType( c );
//remove all 2d elements
smtk::mesh::MeshSet meshes2D = c->meshes( smtk::mesh::Dims2 );
c->removeMeshes( meshes2D );
std::cout << "number of materials: " << c->materials().size() << std::endl;
std::cout << "number of dirichlets: " << c->dirichlets().size() << std::endl;
......
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