# HG changeset patch # User Roeland Merks # Date 2010-06-07 15:50:24 # Node ID aaba9e8828d6f0e601cd4e138bb34e4b8b75ea04 # Parent 5564fc0d72bc226303af060e056aac1821dd88db Added to new menu options: edit->ResetChemicals and edit->ResetTransporters, which allows you to set only the chemicals or only the transporters to the initial values. I needed this for preparing a suitable initial condition for Tutorial 6 and thought it would be useful for the main distribution. -- user: Roeland Merks branch 'default' changed src/build_models/Makefile changed src/canvas.cpp changed src/canvas.h changed src/mesh.cpp changed src/mesh.h diff --git a/src/build_models/Makefile b/src/build_models/Makefile --- a/src/build_models/Makefile +++ b/src/build_models/Makefile @@ -1,37 +1,231 @@ -# $Id: Makefile,v 3f0977faba37 2010/06/03 15:54:37 michael $ +############################################################################# +# Makefile for building: libauxinsimon.so +# Generated by qmake (2.01a) (Qt 4.4.1) on: Mon Jun 7 13:36:27 2010 +# Project: auxinsimon.pro +# Template: lib +# Command: /ufs/merks/Trolltech/Qt-4.4.1/bin/qmake -unix -o Makefile auxinsimon.pro +############################################################################# -QMAKE = qmake +####### Compiler, tools and options -all: plugin_auxingrowth plugin_leaf plugin_meinhardt plugin_test +CC = gcc +CXX = g++ +DEFINES = -DQTGRAPHICS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_QT3SUPPORT_LIB -DQT3_SUPPORT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED +CFLAGS = -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES) +CXXFLAGS = -m64 -pipe -fexceptions -I.. -fPIC -I/usr/include/libxml2 -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES) +INCPATH = -I../../../../Trolltech/Qt-4.4.1/mkspecs/linux-g++-64 -I. -I../../../../Trolltech/Qt-4.4.1/include/QtCore -I../../../../Trolltech/Qt-4.4.1/include/QtCore -I../../../../Trolltech/Qt-4.4.1/include/QtGui -I../../../../Trolltech/Qt-4.4.1/include/QtGui -I../../../../Trolltech/Qt-4.4.1/include/Qt3Support -I../../../../Trolltech/Qt-4.4.1/include/Qt3Support -I../../../../Trolltech/Qt-4.4.1/include -I. -I. +LINK = g++ +LFLAGS = -m64 -fPIC -Wl,-rpath,/ufs/merks/Trolltech/Qt-4.4.1/lib -shared +LIBS = $(SUBLIBS) -L/ufs/merks/Trolltech/Qt-4.4.1/lib -L../../lib -lvleaf -lQt3Support -L/ufs/merks/Trolltech/Qt-4.4.1/lib -lQtSql -pthread -pthread -pthread -pthread -lQtXml -pthread -pthread -pthread -pthread -L/usr/X11R6/lib64 -pthread -pthread -pthread -pthread -pthread -pthread -lQtNetwork -pthread -pthread -pthread -pthread -pthread -pthread -lQtGui -pthread -lpng -lSM -lICE -pthread -pthread -lXi -lXrender -lXrandr -lfreetype -lfontconfig -lXext -lX11 -lQtCore -lz -lm -pthread -lgthread-2.0 -lrt -lglib-2.0 -ldl -lpthread +AR = ar cqs +RANLIB = +QMAKE = /ufs/merks/Trolltech/Qt-4.4.1/bin/qmake +TAR = tar -cf +COMPRESS = gzip -9f +COPY = cp -f +SED = sed +COPY_FILE = $(COPY) +COPY_DIR = $(COPY) -r +INSTALL_FILE = install -m 644 -p +INSTALL_DIR = $(COPY_DIR) +INSTALL_PROGRAM = install -m 755 -p +DEL_FILE = rm -f +SYMLINK = ln -sf +DEL_DIR = rmdir +MOVE = mv -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p -plugin_auxingrowth: Makefile.plugin_auxingrowth - make -f Makefile.plugin_auxingrowth +####### Output directory + +OBJECTS_DIR = ./ + +####### Files -Makefile.plugin_auxingrowth: plugin_auxingrowth.pro - $(QMAKE) -makefile -o $@ $< +SOURCES = auxinsimon.cpp moc_auxinsimon.cpp +OBJECTS = auxinsimon.o \ + moc_auxinsimon.o +DIST = ../../../../Trolltech/Qt-4.4.1/mkspecs/common/g++.conf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/common/unix.conf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/common/linux.conf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/qconfig.pri \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/qt_functions.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/qt_config.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/exclusive_builds.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/default_pre.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/release.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/default_post.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/warn_on.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/qt.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/unix/thread.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/moc.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/resources.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/uic.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/yacc.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/lex.prf \ + auxinsimon.pro +QMAKE_TARGET = auxinsimon +DESTDIR = ../../bin/models/ +TARGET = libauxinsimon.so +TARGETD = libauxinsimon.so -plugin_leaf: Makefile.plugin_leaf - make -f Makefile.plugin_leaf +first: all +####### Implicit rules + +.SUFFIXES: .o .c .cpp .cc .cxx .C + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" -Makefile.plugin_leaf: plugin_leaf.pro - $(QMAKE) -makefile -o $@ $< +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" + +####### Build rules + +all: Makefile ../../bin/models/$(TARGET) + +../../bin/models/$(TARGET): $(OBJECTS) $(SUBLIBS) $(OBJCOMP) + @$(CHK_DIR_EXISTS) ../../bin/models/ || $(MKDIR) ../../bin/models/ + -$(DEL_FILE) $(TARGET) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP) + -$(MOVE) $(TARGET) ../../bin/models/ + + -plugin_meinhardt: Makefile.plugin_meinhardt - make -f Makefile.plugin_meinhardt +Makefile: auxinsimon.pro ../../../../Trolltech/Qt-4.4.1/mkspecs/linux-g++-64/qmake.conf ../../../../Trolltech/Qt-4.4.1/mkspecs/common/g++.conf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/common/unix.conf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/common/linux.conf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/qconfig.pri \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/qt_functions.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/qt_config.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/exclusive_builds.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/default_pre.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/release.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/default_post.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/warn_on.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/qt.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/unix/thread.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/moc.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/resources.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/uic.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/yacc.prf \ + ../../../../Trolltech/Qt-4.4.1/mkspecs/features/lex.prf \ + /ufs/merks/Trolltech/Qt-4.4.1/lib/libQt3Support.prl \ + /ufs/merks/Trolltech/Qt-4.4.1/lib/libQtSql.prl \ + /ufs/merks/Trolltech/Qt-4.4.1/lib/libQtCore.prl \ + /ufs/merks/Trolltech/Qt-4.4.1/lib/libQtXml.prl \ + /ufs/merks/Trolltech/Qt-4.4.1/lib/libQtGui.prl \ + /ufs/merks/Trolltech/Qt-4.4.1/lib/libQtNetwork.prl + $(QMAKE) -unix -o Makefile auxinsimon.pro +../../../../Trolltech/Qt-4.4.1/mkspecs/common/g++.conf: +../../../../Trolltech/Qt-4.4.1/mkspecs/common/unix.conf: +../../../../Trolltech/Qt-4.4.1/mkspecs/common/linux.conf: +../../../../Trolltech/Qt-4.4.1/mkspecs/qconfig.pri: +../../../../Trolltech/Qt-4.4.1/mkspecs/features/qt_functions.prf: +../../../../Trolltech/Qt-4.4.1/mkspecs/features/qt_config.prf: +../../../../Trolltech/Qt-4.4.1/mkspecs/features/exclusive_builds.prf: +../../../../Trolltech/Qt-4.4.1/mkspecs/features/default_pre.prf: +../../../../Trolltech/Qt-4.4.1/mkspecs/features/release.prf: +../../../../Trolltech/Qt-4.4.1/mkspecs/features/default_post.prf: +../../../../Trolltech/Qt-4.4.1/mkspecs/features/warn_on.prf: +../../../../Trolltech/Qt-4.4.1/mkspecs/features/qt.prf: +../../../../Trolltech/Qt-4.4.1/mkspecs/features/unix/thread.prf: +../../../../Trolltech/Qt-4.4.1/mkspecs/features/moc.prf: +../../../../Trolltech/Qt-4.4.1/mkspecs/features/resources.prf: +../../../../Trolltech/Qt-4.4.1/mkspecs/features/uic.prf: +../../../../Trolltech/Qt-4.4.1/mkspecs/features/yacc.prf: +../../../../Trolltech/Qt-4.4.1/mkspecs/features/lex.prf: +/ufs/merks/Trolltech/Qt-4.4.1/lib/libQt3Support.prl: +/ufs/merks/Trolltech/Qt-4.4.1/lib/libQtSql.prl: +/ufs/merks/Trolltech/Qt-4.4.1/lib/libQtCore.prl: +/ufs/merks/Trolltech/Qt-4.4.1/lib/libQtXml.prl: +/ufs/merks/Trolltech/Qt-4.4.1/lib/libQtGui.prl: +/ufs/merks/Trolltech/Qt-4.4.1/lib/libQtNetwork.prl: +qmake: FORCE + @$(QMAKE) -unix -o Makefile auxinsimon.pro -Makefile.plugin_meinhardt: plugin_meinhardt.pro - $(QMAKE) -makefile -o $@ $< +dist: + @$(CHK_DIR_EXISTS) .tmp/auxinsimon1.0.0 || $(MKDIR) .tmp/auxinsimon1.0.0 + $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/auxinsimon1.0.0/ && $(COPY_FILE) --parents ../simplugin.h auxinsimon.h .tmp/auxinsimon1.0.0/ && $(COPY_FILE) --parents auxinsimon.cpp .tmp/auxinsimon1.0.0/ && (cd `dirname .tmp/auxinsimon1.0.0` && $(TAR) auxinsimon1.0.0.tar auxinsimon1.0.0 && $(COMPRESS) auxinsimon1.0.0.tar) && $(MOVE) `dirname .tmp/auxinsimon1.0.0`/auxinsimon1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/auxinsimon1.0.0 + -plugin_test: Makefile.plugin_test - make -f Makefile.plugin_test +clean:compiler_clean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) *~ core *.core + + +####### Sub-libraries -Makefile.plugin_test: plugin_test.pro - $(QMAKE) -makefile -o $@ $< +distclean: clean + -$(DEL_FILE) $(TARGET) + -$(DEL_FILE) Makefile + + +mocclean: compiler_moc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_source_make_all + +compiler_moc_header_make_all: moc_auxinsimon.cpp +compiler_moc_header_clean: + -$(DEL_FILE) moc_auxinsimon.cpp +moc_auxinsimon.cpp: ../simplugin.h \ + ../cellbase.h \ + ../vector.h \ + ../sqr.h \ + ../parameter.h \ + ../wall.h \ + ../wallbase.h \ + ../warning.h \ + auxinsimon.h + /ufs/merks/Trolltech/Qt-4.4.1/bin/moc $(DEFINES) $(INCPATH) auxinsimon.h -o moc_auxinsimon.cpp -clean: - make -f Makefile.plugin_auxingrowth clean - make -f Makefile.plugin_leaf clean - make -f Makefile.plugin_meinhardt clean - make -f Makefile.plugin_test clean +compiler_rcc_make_all: +compiler_rcc_clean: +compiler_image_collection_make_all: qmake_image_collection.cpp +compiler_image_collection_clean: + -$(DEL_FILE) qmake_image_collection.cpp +compiler_moc_source_make_all: +compiler_moc_source_clean: +compiler_uic_make_all: +compiler_uic_clean: +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: compiler_moc_header_clean + +####### Compile -#finis +auxinsimon.o: auxinsimon.cpp ../simplugin.h \ + ../cellbase.h \ + ../vector.h \ + ../sqr.h \ + ../parameter.h \ + ../wall.h \ + ../wallbase.h \ + ../warning.h \ + auxinsimon.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o auxinsimon.o auxinsimon.cpp + +moc_auxinsimon.o: moc_auxinsimon.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_auxinsimon.o moc_auxinsimon.cpp + +####### Install + +install: FORCE + +uninstall: FORCE + +FORCE: + diff --git a/src/canvas.cpp b/src/canvas.cpp --- a/src/canvas.cpp +++ b/src/canvas.cpp @@ -562,6 +562,8 @@ Main::Main(QGraphicsScene& c, Mesh &m, Q Q3PopupMenu* edit = new Q3PopupMenu( menu ); edit->insertItem("Reset Chemicals and Transporters", this, SLOT( CleanMesh()), Qt::CTRL+Qt::Key_R ); + edit->insertItem("Reset Chemicals", this, SLOT( CleanMeshChemicals()) ); + edit->insertItem("Reset Transporters", this, SLOT( CleanMeshTransporters()) ); edit->insertItem("Randomize PIN1 Transporters", this, SLOT( RandomizeMesh()) ); edit->insertItem("Cut away SAM", this, SLOT( CutSAM() )); menu->insertItem("&Edit", edit); @@ -1437,16 +1439,58 @@ void Main::FitLeafToCanvas(void) { } void Main::CleanMesh(void) { - - mesh.SettoInitVals(); + vector clean_chem(Cell::NChem()); + vector clean_transporters(Cell::NChem()); + + for (int i=0;iFullRedraw(); - + Plot(); + + editor->FullRedraw(); + // repaint(); } +void Main::CleanMeshChemicals(void) { + + vector clean_chem(Cell::NChem()); + + for (int i=0;iFullRedraw(); + + // repaint(); +} + +void Main::CleanMeshTransporters(void) { + vector clean_transporters(Cell::NChem()); + for (int i=0;iFullRedraw(); + + // repaint(); +} + void Main::RandomizeMesh(void) { vector max_chem(Cell::NChem()); diff --git a/src/canvas.h b/src/canvas.h --- a/src/canvas.h +++ b/src/canvas.h @@ -226,8 +226,11 @@ class Main : public Q3MainWindow, public void shrink(); void zoomIn(); void zoomOut(); - + void CleanMesh(); + void CleanMeshChemicals(void); + void CleanMeshTransporters(void); + void RandomizeMesh(); signals: diff --git a/src/mesh.cpp b/src/mesh.cpp --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -1888,35 +1888,48 @@ void Mesh::DeleteLooseWalls(void) { }*/ -void Mesh::CleanChemicals(const vector &clean_chem, const vector &clean_transporters) { - - if (clean_chem.size()!=(unsigned)Cell::NChem() || clean_transporters.size()!=(unsigned)Cell::NChem()) { - throw "Run time error in Mesh::CleanChemicals: size of clean_chem and clean_transporters should be equal to Cell::NChem()"; - } - for (vector::iterator c=cells.begin(); - c!=cells.end(); - c++) { - - for (int i=0;iSetChemical(i,clean_chem[i]); - } - (*c)->SetNewChemToChem(); + +void Mesh::CleanChemicals(const vector &clean_chem) { + + if (clean_chem.size()!=(unsigned)Cell::NChem()) { + throw "Run time error in Mesh::CleanChemicals: size of clean_chem should be equal to Cell::NChem()"; + } + for (vector::iterator c=cells.begin(); + c!=cells.end(); + c++) { + + for (int i=0;iSetChemical(i,clean_chem[i]); + } + (*c)->SetNewChemToChem(); + + } + + +} + - } +void Mesh::CleanTransporters(const vector &clean_transporters) { + + if (clean_transporters.size()!=(unsigned)Cell::NChem()) { + throw "Run time error in Mesh::CleanTransporters: size ofclean_transporters should be equal to Cell::NChem()"; + } - // clean transporters - for (list::iterator w=walls.begin(); - w!=walls.end(); - w++) { - - for (int i=0;isetTransporters1(i,clean_transporters[i]); (*w)->setNewTransporters1(i,clean_transporters[i]); - (*w)->setTransporters2(i,clean_transporters[i]); (*w)->setNewTransporters2(i,clean_transporters[i]); - } - } - + + // clean transporters + for (list::iterator w=walls.begin(); + w!=walls.end(); + w++) { + + for (int i=0;isetTransporters1(i,clean_transporters[i]); (*w)->setNewTransporters1(i,clean_transporters[i]); + (*w)->setTransporters2(i,clean_transporters[i]); (*w)->setNewTransporters2(i,clean_transporters[i]); + } + } + } + void Mesh::RandomizeChemicals(const vector &max_chem, const vector &max_transporters) { if (max_chem.size()!=(unsigned)Cell::NChem() || max_transporters.size()!=(unsigned)Cell::NChem()) { @@ -2158,7 +2171,8 @@ void Mesh::SettoInitVals(void) { // Amount of PIN1 //clean_chem[1] = 0.; - CleanChemicals(clean_chem, clean_transporters); + CleanChemicals(clean_chem); + CleanTransporters(clean_transporters); } diff --git a/src/mesh.h b/src/mesh.h --- a/src/mesh.h +++ b/src/mesh.h @@ -413,7 +413,8 @@ public: node_sets.push_back(node_set); } - void CleanChemicals(const vector &clean_chem, const vector &clean_transporters); + void CleanChemicals(const vector &clean_chem); + void CleanTransporters(const vector &clean_transporters); void RandomizeChemicals(const vector &max_chem, const vector &max_transporters); inline double getTime(void) const { return time; } string getTimeHours(void) const;