Commit 8f4f2d4d authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

* ParaReal files added to Makefile.am

parent fe43ddea
......@@ -220,7 +220,9 @@ $(SOURCE_DIR)/DataCollector.h $(SOURCE_DIR)/DataCollector.cc \
$(SOURCE_DIR)/ElementInfo.h \
$(SOURCE_DIR)/VertexInfo.h \
$(SOURCE_DIR)/PeriodicInfo.h \
$(SOURCE_DIR)/OpenMP.h
$(SOURCE_DIR)/OpenMP.h \
$(SOURCE_DIR)/parareal/ProblemBase.h \
$(SOURCE_DIR)/parareal/AdaptParaReal.h $(SOURCE_DIR)/parareal/AdaptParaReal.cc
COMPOSITE_SOURCE_DIR = ../compositeFEM/src
......
......@@ -237,7 +237,9 @@ am__libamdis_la_SOURCES_DIST = $(PARALLEL_DIR)/ConditionalEstimator.h \
$(SOURCE_DIR)/VtkWriter.cc $(SOURCE_DIR)/DataCollector.h \
$(SOURCE_DIR)/DataCollector.cc $(SOURCE_DIR)/ElementInfo.h \
$(SOURCE_DIR)/VertexInfo.h $(SOURCE_DIR)/PeriodicInfo.h \
$(SOURCE_DIR)/OpenMP.h
$(SOURCE_DIR)/OpenMP.h $(SOURCE_DIR)/parareal/ProblemBase.h \
$(SOURCE_DIR)/parareal/AdaptParaReal.h \
$(SOURCE_DIR)/parareal/AdaptParaReal.cc
@USE_PARALLEL_AMDIS_TRUE@am__objects_1 = \
@USE_PARALLEL_AMDIS_TRUE@ libamdis_la-ConditionalEstimator.lo \
@USE_PARALLEL_AMDIS_TRUE@ libamdis_la-MeshStructure.lo \
......@@ -301,7 +303,7 @@ am_libamdis_la_OBJECTS = $(am__objects_1) \
libamdis_la-Triangle.lo libamdis_la-TecPlotWriter.lo \
libamdis_la-ValueWriter.lo libamdis_la-MemoryPool.lo \
libamdis_la-MemoryManager.lo libamdis_la-VtkWriter.lo \
libamdis_la-DataCollector.lo
libamdis_la-DataCollector.lo libamdis_la-AdaptParaReal.lo
libamdis_la_OBJECTS = $(am_libamdis_la_OBJECTS)
libcompositeFEM_la_LIBADD =
am_libcompositeFEM_la_OBJECTS = libcompositeFEM_la-CFE_Integration.lo \
......@@ -649,7 +651,9 @@ $(SOURCE_DIR)/DataCollector.h $(SOURCE_DIR)/DataCollector.cc \
$(SOURCE_DIR)/ElementInfo.h \
$(SOURCE_DIR)/VertexInfo.h \
$(SOURCE_DIR)/PeriodicInfo.h \
$(SOURCE_DIR)/OpenMP.h
$(SOURCE_DIR)/OpenMP.h \
$(SOURCE_DIR)/parareal/ProblemBase.h \
$(SOURCE_DIR)/parareal/AdaptParaReal.h $(SOURCE_DIR)/parareal/AdaptParaReal.cc
COMPOSITE_SOURCE_DIR = ../compositeFEM/src
libcompositeFEM_la_CXXFLAGS = $(libamdis_la_CXXFLAGS)
......@@ -749,6 +753,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-AdaptBase.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-AdaptInfo.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-AdaptInstationary.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-AdaptParaReal.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-AdaptStationary.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Assembler.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-BFGS_Precond.Plo@am__quote@
......@@ -1603,6 +1608,13 @@ libamdis_la-DataCollector.lo: $(SOURCE_DIR)/DataCollector.cc
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -c -o libamdis_la-DataCollector.lo `test -f '$(SOURCE_DIR)/DataCollector.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/DataCollector.cc
libamdis_la-AdaptParaReal.lo: $(SOURCE_DIR)/parareal/AdaptParaReal.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -MT libamdis_la-AdaptParaReal.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-AdaptParaReal.Tpo" -c -o libamdis_la-AdaptParaReal.lo `test -f '$(SOURCE_DIR)/parareal/AdaptParaReal.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/parareal/AdaptParaReal.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-AdaptParaReal.Tpo" "$(DEPDIR)/libamdis_la-AdaptParaReal.Plo"; else rm -f "$(DEPDIR)/libamdis_la-AdaptParaReal.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(SOURCE_DIR)/parareal/AdaptParaReal.cc' object='libamdis_la-AdaptParaReal.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -c -o libamdis_la-AdaptParaReal.lo `test -f '$(SOURCE_DIR)/parareal/AdaptParaReal.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/parareal/AdaptParaReal.cc
libcompositeFEM_la-CFE_Integration.lo: $(COMPOSITE_SOURCE_DIR)/CFE_Integration.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcompositeFEM_la_CXXFLAGS) $(CXXFLAGS) -MT libcompositeFEM_la-CFE_Integration.lo -MD -MP -MF "$(DEPDIR)/libcompositeFEM_la-CFE_Integration.Tpo" -c -o libcompositeFEM_la-CFE_Integration.lo `test -f '$(COMPOSITE_SOURCE_DIR)/CFE_Integration.cc' || echo '$(srcdir)/'`$(COMPOSITE_SOURCE_DIR)/CFE_Integration.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libcompositeFEM_la-CFE_Integration.Tpo" "$(DEPDIR)/libcompositeFEM_la-CFE_Integration.Plo"; else rm -f "$(DEPDIR)/libcompositeFEM_la-CFE_Integration.Tpo"; exit 1; fi
......
......@@ -58,7 +58,9 @@ namespace AMDiS {
Creator(const ::std::string &name_,
::std::vector<FiniteElemSpace*> feSpace_,
int size_)
: name(name_), feSpace(feSpace_), size(size_)
: name(name_),
feSpace(feSpace_),
size(size_)
{};
/** \brief
......@@ -133,7 +135,7 @@ namespace AMDiS {
vectors(rhs.vectors.getSize())
{
for (int i = 0; i < vectors.getSize();i++) {
for (int i = 0; i < vectors.getSize(); i++) {
vectors[i] = new DOFVector<double>(*rhs.vectors[i]);
}
};
......@@ -168,7 +170,8 @@ namespace AMDiS {
* Returns sum of used vector sizes.
*/
inline int getUsedSize() const {
int totalSize = 0, size = vectors.getSize();
int totalSize = 0;
int size = vectors.getSize();
for (int i = 0; i < size; i++) {
totalSize += vectors[i]->getUsedSize();
}
......@@ -203,7 +206,7 @@ namespace AMDiS {
int localIndex = index;
int vectorIndex = 0;
while(localIndex >= vectors[vectorIndex]->getUsedSize()) {
while (localIndex >= vectors[vectorIndex]->getUsedSize()) {
localIndex -= vectors[vectorIndex++]->getUsedSize();
}
......@@ -217,7 +220,7 @@ namespace AMDiS {
int localIndex = index;
int vectorIndex = 0;
while(localIndex >= vectors[vectorIndex]->getUsedSize()) {
while (localIndex >= vectors[vectorIndex]->getUsedSize()) {
localIndex -= vectors[vectorIndex++]->getUsedSize();
}
......@@ -258,36 +261,36 @@ namespace AMDiS {
};
void serialize(::std::ostream &out) {
int i, size = vectors.getSize();
int size = vectors.getSize();
out.write(reinterpret_cast<const char*>(&size), sizeof(int));
for(i = 0; i < size; i++) {
for (int i = 0; i < size; i++) {
vectors[i]->serialize(out);
}
};
void deserialize(::std::istream &in) {
int i, size, oldSize = vectors.getSize();
int size, oldSize = vectors.getSize();
in.read(reinterpret_cast<char*>(&size), sizeof(int));
vectors.resize(size);
for(i = oldSize; i < size; i++) {
for (int i = oldSize; i < size; i++) {
vectors[i] = NEW DOFVector<double>(feSpace[i], "");
}
for(i = 0; i < size; i++) {
for (int i = 0; i < size; i++) {
vectors[i]->deserialize(in);
}
};
void copy(const SystemVector& rhs) {
int i, size = vectors.getSize();
int size = vectors.getSize();
TEST_EXIT_DBG(size == rhs.getNumVectors())("invalid sizes\n");
for(i = 0; i < size; i++) {
for (int i = 0; i < size; i++) {
vectors[i]->copy(*(const_cast<SystemVector&>(rhs).getDOFVector(i)));
}
};
void interpol(::std::vector<AbstractFunction<double, WorldVector<double> >*> *f) {
int i, size = vectors.getSize();
for(i = 0; i < size; i++) {
int size = vectors.getSize();
for (int i = 0; i < size; i++) {
vectors[i]->interpol((*f)[i]);
}
};
......
......@@ -4,15 +4,19 @@
namespace AMDiS {
int AdaptParaReal::adapt()
{
// Compute number of coarse and fine time stages.
int coarseStages = static_cast<int>(round(adaptInfo_->getEndTime() / coarseTimestep));
int fineStages = static_cast<int>(round(coarseTimestep / fineTimestep));
// First, sequentially calculate first approximation on coarse time grid.
adaptInfo_->setTimestep(coarseTimestep);
pararealProb->setStoreSolutions(false, true);
pararealProb->setStoreInitSolution(true);
AdaptInstationary::adapt();
// ParaReal iterations
for (int k = 0; k < pararealIter; k++) {
// Compute solutions with fine timestep on the coarse grid slides.
for (int i = 0; i < coarseStages; i++) {
adaptInfo_->resetTimeValues(fineTimestep,
i * coarseTimestep,
......@@ -25,13 +29,13 @@ namespace AMDiS {
AdaptInstationary::adapt();
}
// Copy coarse grid solutions to another vector.
std::vector<DOFVector<double> *> coarseSolutions =
(*pararealProb->getCoarseSolutions());
pararealProb->clearCoarseSolutions();
pararealProb->clearCoarseSolutions();
(*pararealProb->getCoarseSolutions()).push_back(coarseSolutions[0]);
// Again, compute solutions on coarse grid and calculate the corrected solutions.
for (int i = 1; i <= coarseStages; i++) {
adaptInfo_->resetTimeValues(coarseTimestep,
(i - 1) * coarseTimestep,
......
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