Skip to content
Snippets Groups Projects
Commit 0aa007e4 authored by Robert Kloefkorn's avatar Robert Kloefkorn
Browse files

formatting

parent 83200591
No related branches found
No related tags found
No related merge requests found
......@@ -144,9 +144,9 @@ bool GitterDuneBasis :: refine () {
std::cout << "check non conform refinement" << std::endl;
x = true ;
for( i.first(); ! i.done() ; i.next()) { std::cout << "***" << std::endl; x &= i.item ().markNonConform () ; }
std::ostringstream ss;
std::ostringstream ss;
int filenr = adaptstep*100+nr;
ss << "ref-" << ZeroPadNumber(filenr) << ".vtk";
ss << "ref-" << ZeroPadNumber(filenr) << ".vtk";
tovtk( ss.str() );
++nr;
// break;
......@@ -223,16 +223,16 @@ void GitterDuneBasis :: tovtk( const std::string &fn)
for (w->first () ; ! w->done () ; w->next ())
{
tetra_IMPL* item = ((tetra_IMPL *) &w->item ());
tetra_IMPL* item = ((tetra_IMPL *) &w->item ());
for (int i=0;i<4;++i)
{
Vertex v ( item->myvertex(i)->Point(), item->myvertex(i)->Point() + sizeof( item->myvertex(i)->Point() ) / sizeof( double ) );
vertexList[ item->myvertex(i)->getIndex() ]
= v;
}
for (int i=0;i<4;++i)
{
Vertex v ( item->myvertex(i)->Point(), item->myvertex(i)->Point() + sizeof( item->myvertex(i)->Point() ) / sizeof( double ) );
vertexList[ item->myvertex(i)->getIndex() ]
= v;
}
++nCells;
++nCells;
}
}
......@@ -241,9 +241,9 @@ void GitterDuneBasis :: tovtk( const std::string &fn)
vtkFile << "POINTS " << vertexList.size() << " double" << std::endl;
for( unsigned int i = 0; i < vertexList.size(); ++i )
{
vtkFile << vertexList[ i ][ 0 ]
<< " " << vertexList[ i ][ 1 ]
<< " " << vertexList[ i ][ 2 ] << std::endl;
vtkFile << vertexList[ i ][ 0 ]
<< " " << vertexList[ i ][ 1 ]
<< " " << vertexList[ i ][ 2 ] << std::endl;
}
}
......@@ -254,18 +254,18 @@ void GitterDuneBasis :: tovtk( const std::string &fn)
typedef Objects :: tetra_IMPL tetra_IMPL ;
LeafIterator < Gitter::helement_STI > w (*this) ;
for (w->first () ; ! w->done () ; w->next ())
{
tetra_IMPL* item = ((tetra_IMPL *) &w->item ());
vtkFile << 4;
{
tetra_IMPL* item = ((tetra_IMPL *) &w->item ());
for (int i=0;i<4;++i)
{
vtkFile << " " << item->myvertex(i)->getIndex();
}
vtkFile << 4;
vtkFile << std::endl;
for (int i=0;i<4;++i)
{
vtkFile << " " << item->myvertex(i)->getIndex();
}
vtkFile << std::endl;
}
}
// cell type info
......@@ -273,9 +273,9 @@ void GitterDuneBasis :: tovtk( const std::string &fn)
vtkFile << "CELL_TYPES " << nCells << std::endl;
for( int i = 0; i < nCells; ++i )
{
vtkFile << 10 << std::endl; // 10 for a tetrahedron
}
{
vtkFile << 10 << std::endl; // 10 for a tetrahedron
}
}
// cell data
......@@ -287,165 +287,15 @@ void GitterDuneBasis :: tovtk( const std::string &fn)
typedef Objects :: tetra_IMPL tetra_IMPL ;
LeafIterator < Gitter::helement_STI > w (*this) ;
for (w->first () ; ! w->done () ; w->next ())
{
tetra_IMPL* item = ((tetra_IMPL *) &w->item ());
{
tetra_IMPL* item = ((tetra_IMPL *) &w->item ());
vtkFile << item->getIndex() << std::endl;
}
vtkFile << item->getIndex() << std::endl;
}
}
vtkFile.close();
std::cout << "data written to " << fn << std::endl;
}
#if 0
void GitterDuneBasis :: ALUcomm (
GatherScatterType & vertexData ,
GatherScatterType & edgeData,
GatherScatterType & faceData ,
GatherScatterType & elementData,
const CommunicationType commType )
{
const int nl = mpAccess ().nlinks ();
const bool containsVertices = vertexData.contains(3,3);
const bool containsEdges = edgeData.contains(3,2);
const bool containsFaces = faceData.contains(3,1);
const bool containsElements = elementData.contains(3,0);
const bool haveHigherCodimData = containsVertices ||
containsEdges ||
containsFaces ;
const bool containsSomeThing = containsElements || haveHigherCodimData;
if(!containsSomeThing)
{
cerr << "WARNING: communication called with empty data set, all contains methods returned false! \n";
return ;
}
assert ((debugOption (5) && containsVertices) ? (cout << "**INFO GitterDuneBasis :: ALUcomm (): (containsVertices)=true " << endl, 1) : 1) ;
assert ((debugOption (5) && containsEdges) ? (cout << "**INFO GitterDuneBasis :: ALUcomm (): (containsEdges)=true " << endl, 1) : 1) ;
assert ((debugOption (5) && containsFaces) ? (cout << "**INFO GitterDuneBasis :: ALUcomm (): (containsFaces)=true " << endl, 1) : 1) ;
assert ((debugOption (5) && containsElements) ? (cout << "**INFO GitterDuneBasis :: ALUcomm (): (containsElements)=true " << endl, 1) : 1) ;
// create vector of message buffers
// this vector is created here, that the buffer is allocated only once
vector < ObjectStream > vec (nl) ;
// if data on entities of higer codim exists
// then communication if more complicated
if ( haveHigherCodimData )
{
doBorderBorderComm( vec, vertexData, edgeData, faceData );
}
if( commType != Border_Border_Comm ) // otherwise only border border
{
doInteriorGhostComm( vec, vertexData, edgeData, faceData, elementData , commType );
}
return ;
}
void GitterDunePll :: doInteriorGhostComm(
vector< ObjectStream > & osvec ,
GatherScatterType & vertexData ,
GatherScatterType & edgeData,
GatherScatterType & faceData,
GatherScatterType & elementData ,
const CommunicationType commType )
{
//Entwurf der periodischen R"ander-Ghost-Kommunikation:
/*
it = Iterator "uber alle periodischen R"ander
for (it = begin; !.it.done(); it++) {
periodic & per = it.item()
osvec[0].clear();
per.myneighbour(0).gather (osvec[0]);
per.getGhost(1).scatter (osvec[0]);
osvec[0].clear();
per.myneighbour(1).gather(osvec[0]);
per.getGhost(0).scatter(osvec[0]);
}
*/
const int nl = mpAccess ().nlinks ();
const bool containsVertices = vertexData.contains(3,3);
const bool containsEdges = edgeData.contains(3,2);
const bool containsFaces = faceData.contains(3,1);
const bool containsElements = elementData.contains(3,0);
const bool containsSomeThing = containsVertices ||
containsEdges || containsFaces || containsElements ;
const bool packInterior = (commType == All_All_Comm) ||
(commType == Interior_Ghost_Comm);
const bool packGhosts = (commType == All_All_Comm) ||
(commType == Ghost_Interior_Comm);
assert( !packGhosts );
if(!containsSomeThing)
{
cerr << "WARNING: communication called with empty data set, all contains methods returned false! \n";
return ;
}
for (int link = 0 ; link < nl ; ++link )
{
ObjectStream & sendBuff = osvec[link];
sendBuff.clear();
{
hface_STI * determType = 0; // only for type determination
pair < IteratorSTI < hface_STI > * , IteratorSTI < hface_STI > * >
iterpair = borderIteratorTT( determType , link );
// write all data belong to interior of master faces
sendInteriorGhostData( sendBuff, iterpair.first ,
vertexData, edgeData,
faceData, elementData,
packInterior , packGhosts );
// write all data belong to interior of slave faces
sendInteriorGhostData( sendBuff, iterpair.second ,
vertexData, edgeData,
faceData, elementData ,
packInterior , packGhosts );
delete iterpair.first;
delete iterpair.second;
}
}
///////////////////////////////////////////
// exchange data
///////////////////////////////////////////
osvec = mpAccess ().exchange (osvec) ;
//all ghost cells get new data
for (int link = 0 ; link < nl ; ++link )
{
ObjectStream & recvBuff = osvec[link];
{
hface_STI * determType = 0; // only for type determination
pair < IteratorSTI < hface_STI > * , IteratorSTI < hface_STI > * >
iterpair = borderIteratorTT( determType , link );
// first unpack slave data, because this has been pack from master
// first , see above
unpackInteriorGhostData( recvBuff, iterpair.second ,
vertexData, edgeData,
faceData, elementData );
// now unpack data sended from slaves to master
unpackInteriorGhostData( recvBuff, iterpair.first ,
vertexData, edgeData,
faceData, elementData );
delete iterpair.first;
delete iterpair.second;
}
}
// end element communication
return ;
}
#endif
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment