Skip to content
Snippets Groups Projects
Commit 46941251 authored by Oliver Sander's avatar Oliver Sander Committed by sander@PCPOOL.MI.FU-BERLIN.DE
Browse files

compile with current Dune

[[Imported from SVN: r10049]]
parent bb21c2fe
Branches
Tags
No related merge requests found
......@@ -244,7 +244,7 @@ int main (int argc, char *argv[]) try
// Output result
LeafAmiraMeshWriter<GridType> amiramesh;
amiramesh.addLeafGrid(grid,true);
amiramesh.addVertexData(x, grid.leafIndexSet());
amiramesh.addVertexData(x, grid.leafView());
amiramesh.write("resultGrid");
} catch (Exception e) {
......
#include <config.h>
#include <dune/common/bitfield.hh>
#include <dune/common/bitsetvector.hh>
#include <dune/common/configparser.hh>
#include <dune/grid/uggrid.hh>
......@@ -83,13 +83,13 @@ int main (int argc, char *argv[]) try
PatchProlongator<GridType>::prolong(dirichletBoundary);
std::vector<BitField> dirichletNodes(numLevels);
std::vector<BitSetVector<dim> > dirichletNodes(numLevels);
for (int i=0; i<numLevels; i++) {
dirichletNodes[i].resize(grid.size(i, dim)*dim);
dirichletNodes[i].resize(grid.size(i, dim));
for (int j=0; j<grid.size(i, dim); j++) {
for (int k=0; k<dim; k++)
dirichletNodes[i][j*dim+k] = dirichletBoundary[i].containsVertex(j);
dirichletNodes[i][j][k] = dirichletBoundary[i].containsVertex(j);
}
}
......@@ -151,7 +151,7 @@ int main (int argc, char *argv[]) try
QuadraticIPOptSolver<OperatorType,VectorType> solver;
solver.verbosity_ = NumProc::QUIET;
solver.dirichletNodes_ = &dirichletNodes[maxlevel];
solver.ignoreNodes_ = &dirichletNodes[maxlevel];
#elif defined GAUSS_SEIDEL
......@@ -226,7 +226,7 @@ int main (int argc, char *argv[]) try
// Set new Dirichlet values in solution
for (int j=0; j<x.size(); j++)
for (int k=0; k<dim; k++)
if (dirichletNodes[maxlevel][j*dim+k])
if (dirichletNodes[maxlevel][j][k])
x[j][k] = scaledDirichlet[j][k];
......@@ -244,7 +244,7 @@ int main (int argc, char *argv[]) try
// Set new Dirichlet values in the right hand side
for (int k=0; k<rhs.size(); k++)
for (int l=0; l<dim; l++)
if (dirichletNodes[maxlevel][k*dim+l])
if (dirichletNodes[maxlevel][k][l])
rhs[k][l] = 0;
solver.setProblem(*ogdenAssembler.matrix_, corr, rhs);
......@@ -277,7 +277,7 @@ int main (int argc, char *argv[]) try
// Output result
LeafAmiraMeshWriter<GridType> amiramesh;
amiramesh.addLeafGrid(grid,true);
amiramesh.addVertexData(x, grid.leafIndexSet());
amiramesh.addVertexData(x, grid.leafView());
amiramesh.write("resultGrid",true);
} catch (Exception e) {
......
#include <config.h>
#include <dune/common/bitfield.hh>
#include <dune/common/bitsetvector.hh>
#include <dune/common/configparser.hh>
#include <dune/grid/uggrid.hh>
......@@ -16,7 +16,7 @@
#include <dune/ag-common/readbitfield.hh>
#include <dune/ag-common/blockgsstep.hh>
#include <dune/ag-common/multigridstep.hh>
#include <dune/ag-common/multigridtransfer.hh>
#include <dune/ag-common/transferoperators/compressedmultigridtransfer.hh>
#include <dune/ag-common/iterativesolver.hh>
#include <dune/ag-common/computestress.hh>
#include <dune/ag-common/neumannassembler.hh>
......@@ -40,26 +40,6 @@
// The grid dimension
const int dim = 3;
// function which turns an integer into a string
//used for naming the different resultGrids of the timesteps
inline std::string int_to_string(int x){
int j=x;
int k =(int) floor(log10(j));
std::string s="";
int p;
char c;
for (int i=0;i<=k;++i){
p=(int) floor(j/pow(10,k-i));
c=(char) (p+48);
s+=c;
j-=(int) (p*pow(10,k-i));
}
return s;
}
using namespace Dune;
......@@ -131,11 +111,11 @@ int main (int argc, char *argv[]) try
// Read Dirichlet boundary values
std::vector<BitField> dirichletNodes(maxLevel+1);
readBitField(dirichletNodes[0], grid.size(0, dim), path + dirichletFile);
std::vector<BitSetVector<dim> > dirichletNodes(maxLevel+1);
std::vector<BoundaryPatch<GridType> > dirichletBoundary(maxLevel+1);
dirichletBoundary[0].setup(grid, 0, dirichletNodes[0]);
dirichletBoundary[0].setup(grid, 0);
readBoundaryPatch(dirichletBoundary[0], path + dirichletFile);
std::vector<VectorType> dirichletValues(maxLevel+1);
dirichletValues[0].resize(grid.size(0, dim));
......@@ -151,15 +131,15 @@ int main (int argc, char *argv[]) try
dirichletBoundaryAll[0].setup(grid, 0, dirichletNodesAll[0]);
*/
std::vector<BitField> neumannNodes(maxLevel+1);
std::vector<BitSetVector<dim> > neumannNodes(maxLevel+1);
std::vector<BoundaryPatch<GridType> > neumannBoundary(maxLevel+1);
std::vector<VectorType> neumannValues(maxLevel+1);
//Read neumann boundary values
if (neumannBV) {
readBitField(neumannNodes[0], grid.size(0, dim), path + neumannFile);
neumannBoundary[0].setup(grid, 0, neumannNodes[0]);
neumannBoundary[0].setup(grid, 0);
readBoundaryPatch(neumannBoundary[0], path + neumannFile);
neumannValues[0].resize(grid.size(0,dim));
AmiraMeshReader<int>::readFunction(neumannValues[0], path + neumannValuesFile);
}
......@@ -193,8 +173,7 @@ int main (int argc, char *argv[]) try
dirichletNodes[i].resize(grid.size(i,dim)*dim);
for (int j=0; j<grid.size(i,dim); j++)
for (int k=0; k<dim; k++)
dirichletNodes[i][j*dim+k] = dirichletBoundary[i].containsVertex(j);
dirichletNodes[i][j] = dirichletBoundary[i].containsVertex(j);
}
......@@ -205,10 +184,10 @@ int main (int argc, char *argv[]) try
PatchProlongator<GridType>::prolong(neumannBoundary);
for (int i=0; i<=grid.maxLevel(); i++) {
neumannNodes[i].resize(grid.size(i,dim)*dim);
neumannNodes[i].resize(grid.size(i,dim));
for (int j=0; j<grid.size(i,dim); j++)
for (int k=0; k<dim; k++)
neumannNodes[i][j*dim+k] = neumannBoundary[i].containsVertex(j);
neumannNodes[i][j][k] = neumannBoundary[i].containsVertex(j);
}
sampleOnBitField(grid, neumannValues, neumannNodes);
......@@ -229,7 +208,7 @@ int main (int argc, char *argv[]) try
for (int i=0; i<rhs.size(); i++)
for (int j=0; j<dim; j++) {
if (dirichletNodes[grid.maxLevel()][i*dim+j])
if (dirichletNodes[grid.maxLevel()][i][j])
x[i][j] = dirichletValues[grid.maxLevel()][i][j];
}
......@@ -245,12 +224,6 @@ int main (int argc, char *argv[]) try
elasticbilinearForm.assemble(lstiff,u,f);
//Assemble viscous part of the problem
//Needed?
*u=0;
*f=0;
LinearViscosityLocalStiffness<GridType::LeafGridView,double> vstiff(nu_shear,nu_bulk);
LeafP1OperatorAssembler<GridType,double,dim> viscousbilinearForm(grid);
viscousbilinearForm.assemble(vstiff,u,f);
......@@ -275,7 +248,7 @@ int main (int argc, char *argv[]) try
EnergyNorm<OperatorType, VectorType> baseEnergyNorm(baseSolverStep);
IterativeSolver<VectorType> baseSolver(&baseSolverStep,
::LoopSolver<VectorType> baseSolver(&baseSolverStep,
baseIt,
baseTolerance,
&baseEnergyNorm,
......@@ -311,7 +284,7 @@ int main (int argc, char *argv[]) try
multigridStep.setMGType(1, nu1, nu2);
multigridStep.dirichletNodes_ = &dirichletNodes;
multigridStep.ignoreNodes_ = &dirichletNodes.back();
multigridStep.basesolver_ = &baseSolver;
multigridStep.presmoother_ = &presmoother;
......@@ -319,14 +292,14 @@ int main (int argc, char *argv[]) try
multigridStep.mgTransfer_.resize(grid.maxLevel());
for (int i=0; i<multigridStep.mgTransfer_.size(); i++) {
MultiGridTransfer<VectorType>* newTransferOp = new MultiGridTransfer<VectorType>;
CompressedMultigridTransfer<VectorType>* newTransferOp = new CompressedMultigridTransfer<VectorType>;
newTransferOp->setup(grid, i, i+1);
multigridStep.mgTransfer_[i] = newTransferOp;
}
EnergyNorm<OperatorType, VectorType> energyNorm(multigridStep);
IterativeSolver<VectorType> solver(&multigridStep,
::LoopSolver<VectorType> solver(&multigridStep,
numIt,
tolerance,
&energyNorm,
......@@ -343,11 +316,16 @@ int main (int argc, char *argv[]) try
x = multigridStep.getSol();
std::string name= "resultGrid";
std::string num=int_to_string(j);
// make string from int (always four digits, with leading zeros)
std::stringstream numberString;
numberString << std::setw(4) << std::setfill('0') << j;
std::string num = numberString.str();
name+=num;
LeafAmiraMeshWriter<GridType> amiramesh;
amiramesh.addLeafGrid(grid,true);
amiramesh.addVertexData(x, grid.leafView(),true);
amiramesh.addVertexData(x, grid.leafView());
amiramesh.write(resultpath + name,1);
......@@ -363,7 +341,7 @@ int main (int argc, char *argv[]) try
std::string namestress= "resultGridstress";
namestress+=num;
Stress<GridType,dim>::getViscoelasticStress(grid, x, v, stress, E, nu, nu_bulk, nu_shear);
LeafAmiraMeshWriter<GridType>::writeBlockVector(grid, stress, resultpath + namestress,true);
LeafAmiraMeshWriter<GridType>::writeBlockVector(grid, stress, resultpath + namestress);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment