Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding Set, Stream, System, WaveTest

  • Loading branch information...
commit 356f1f54d722ffc249f6e493ab392ed3df624b23 1 parent cda041a
Mike Barriault authored
122 T3nsors.xcodeproj/project.pbxproj
View
@@ -18,6 +18,15 @@
6C3B75351449CC9F007125BA /* Field.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6C3B7527144882BF007125BA /* Field.cpp */; };
6C40DD8A144CB74C00529720 /* Axisymmetric.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C40DD89144CB74C00529720 /* Axisymmetric.h */; settings = {ATTRIBUTES = (Public, ); }; };
6C40DD8C144CB75200529720 /* Axisymmetric.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6C40DD8B144CB75200529720 /* Axisymmetric.cpp */; };
+ 6C40DD8E144CE9C800529720 /* Set.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C40DD8D144CE9C800529720 /* Set.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 6C40DD90144CE9CE00529720 /* Set.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6C40DD8F144CE9CE00529720 /* Set.cpp */; };
+ 6C40DD92144CEAA200529720 /* Stream.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C40DD91144CEAA200529720 /* Stream.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 6C40DD94144CEAA800529720 /* Stream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6C40DD93144CEAA800529720 /* Stream.cpp */; };
+ 6C40DD96144CF01600529720 /* System.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C40DD95144CF01600529720 /* System.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 6C40DD98144CF01B00529720 /* System.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6C40DD97144CF01B00529720 /* System.cpp */; };
+ 6C40DDA1144CF72800529720 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6C40DDA0144CF72800529720 /* main.cpp */; };
+ 6C40DDA3144CF72800529720 /* WaveTest.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 6C40DDA2144CF72800529720 /* WaveTest.1 */; };
+ 6C40DDA9144CF73C00529720 /* T3nsors.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 6C3B75031448737B007125BA /* T3nsors.dylib */; };
6CA95855144C842900E50B34 /* Partial.h in Headers */ = {isa = PBXBuildFile; fileRef = 6CA95854144C842900E50B34 /* Partial.h */; settings = {ATTRIBUTES = (Public, ); }; };
6CA95857144C843600E50B34 /* Object.h in Headers */ = {isa = PBXBuildFile; fileRef = 6CA95856144C843600E50B34 /* Object.h */; settings = {ATTRIBUTES = (Public, ); }; };
6CA95859144C855B00E50B34 /* Partial.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6CA95858144C855B00E50B34 /* Partial.cpp */; };
@@ -40,6 +49,13 @@
remoteGlobalIDString = 6C3B75021448737B007125BA;
remoteInfo = T3nsors;
};
+ 6C40DDA7144CF72D00529720 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 6C3B74FA1448737A007125BA /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 6C3B75021448737B007125BA;
+ remoteInfo = T3nsors;
+ };
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
@@ -53,6 +69,16 @@
);
runOnlyForDeploymentPostprocessing = 1;
};
+ 6C40DD9B144CF72800529720 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = /usr/share/man/man1/;
+ dstSubfolderSpec = 0;
+ files = (
+ 6C40DDA3144CF72800529720 /* WaveTest.1 in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
@@ -71,6 +97,15 @@
6C3B752D14488304007125BA /* Tuple.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = Tuple.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
6C40DD89144CB74C00529720 /* Axisymmetric.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Axisymmetric.h; sourceTree = "<group>"; };
6C40DD8B144CB75200529720 /* Axisymmetric.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Axisymmetric.cpp; sourceTree = "<group>"; };
+ 6C40DD8D144CE9C800529720 /* Set.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Set.h; sourceTree = "<group>"; };
+ 6C40DD8F144CE9CE00529720 /* Set.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Set.cpp; sourceTree = "<group>"; };
+ 6C40DD91144CEAA200529720 /* Stream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Stream.h; sourceTree = "<group>"; };
+ 6C40DD93144CEAA800529720 /* Stream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Stream.cpp; sourceTree = "<group>"; };
+ 6C40DD95144CF01600529720 /* System.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = System.h; sourceTree = "<group>"; };
+ 6C40DD97144CF01B00529720 /* System.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = System.cpp; sourceTree = "<group>"; };
+ 6C40DD9D144CF72800529720 /* WaveTest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = WaveTest; sourceTree = BUILT_PRODUCTS_DIR; };
+ 6C40DDA0144CF72800529720 /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
+ 6C40DDA2144CF72800529720 /* WaveTest.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = WaveTest.1; sourceTree = "<group>"; };
6CA95854144C842900E50B34 /* Partial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Partial.h; sourceTree = "<group>"; };
6CA95856144C843600E50B34 /* Object.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = Object.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
6CA95858144C855B00E50B34 /* Partial.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Partial.cpp; sourceTree = "<group>"; };
@@ -101,6 +136,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 6C40DD9A144CF72800529720 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 6C40DDA9144CF73C00529720 /* T3nsors.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
@@ -109,6 +152,7 @@
children = (
6C3B75051448737B007125BA /* T3nsors */,
6C3B7519144873CC007125BA /* T3Test */,
+ 6C40DD9F144CF72800529720 /* WaveTest */,
6C3B75041448737B007125BA /* Products */,
);
sourceTree = "<group>";
@@ -118,6 +162,7 @@
children = (
6C3B75031448737B007125BA /* T3nsors.dylib */,
6C3B7517144873CC007125BA /* T3Test */,
+ 6C40DD9D144CF72800529720 /* WaveTest */,
);
name = Products;
sourceTree = "<group>";
@@ -147,6 +192,12 @@
6CA95862144CA75800E50B34 /* Cartesian.cpp */,
6C40DD89144CB74C00529720 /* Axisymmetric.h */,
6C40DD8B144CB75200529720 /* Axisymmetric.cpp */,
+ 6C40DD8D144CE9C800529720 /* Set.h */,
+ 6C40DD8F144CE9CE00529720 /* Set.cpp */,
+ 6C40DD91144CEAA200529720 /* Stream.h */,
+ 6C40DD93144CEAA800529720 /* Stream.cpp */,
+ 6C40DD95144CF01600529720 /* System.h */,
+ 6C40DD97144CF01B00529720 /* System.cpp */,
6C3B75061448737B007125BA /* Supporting Files */,
);
path = T3nsors;
@@ -169,6 +220,15 @@
path = T3Test;
sourceTree = "<group>";
};
+ 6C40DD9F144CF72800529720 /* WaveTest */ = {
+ isa = PBXGroup;
+ children = (
+ 6C40DDA0144CF72800529720 /* main.cpp */,
+ 6C40DDA2144CF72800529720 /* WaveTest.1 */,
+ );
+ path = WaveTest;
+ sourceTree = "<group>";
+ };
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
@@ -188,6 +248,9 @@
6CA9585B144C989F00E50B34 /* Connection.h in Headers */,
6CA95861144CA6CC00E50B34 /* Cartesian.h in Headers */,
6C40DD8A144CB74C00529720 /* Axisymmetric.h in Headers */,
+ 6C40DD8E144CE9C800529720 /* Set.h in Headers */,
+ 6C40DD92144CEAA200529720 /* Stream.h in Headers */,
+ 6C40DD96144CF01600529720 /* System.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -229,6 +292,24 @@
productReference = 6C3B7517144873CC007125BA /* T3Test */;
productType = "com.apple.product-type.tool";
};
+ 6C40DD9C144CF72800529720 /* WaveTest */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 6C40DDA4144CF72800529720 /* Build configuration list for PBXNativeTarget "WaveTest" */;
+ buildPhases = (
+ 6C40DD99144CF72800529720 /* Sources */,
+ 6C40DD9A144CF72800529720 /* Frameworks */,
+ 6C40DD9B144CF72800529720 /* CopyFiles */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 6C40DDA8144CF72D00529720 /* PBXTargetDependency */,
+ );
+ name = WaveTest;
+ productName = WaveTest;
+ productReference = 6C40DD9D144CF72800529720 /* WaveTest */;
+ productType = "com.apple.product-type.tool";
+ };
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@@ -252,6 +333,7 @@
targets = (
6C3B75021448737B007125BA /* T3nsors */,
6C3B7516144873CC007125BA /* T3Test */,
+ 6C40DD9C144CF72800529720 /* WaveTest */,
);
};
/* End PBXProject section */
@@ -269,6 +351,9 @@
6CA95859144C855B00E50B34 /* Partial.cpp in Sources */,
6CA95863144CA75800E50B34 /* Cartesian.cpp in Sources */,
6C40DD8C144CB75200529720 /* Axisymmetric.cpp in Sources */,
+ 6C40DD90144CE9CE00529720 /* Set.cpp in Sources */,
+ 6C40DD94144CEAA800529720 /* Stream.cpp in Sources */,
+ 6C40DD98144CF01B00529720 /* System.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -280,6 +365,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 6C40DD99144CF72800529720 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 6C40DDA1144CF72800529720 /* main.cpp in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
@@ -288,6 +381,11 @@
target = 6C3B75021448737B007125BA /* T3nsors */;
targetProxy = 6C3B752F1448AD09007125BA /* PBXContainerItemProxy */;
};
+ 6C40DDA8144CF72D00529720 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 6C3B75021448737B007125BA /* T3nsors */;
+ targetProxy = 6C40DDA7144CF72D00529720 /* PBXContainerItemProxy */;
+ };
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
@@ -366,6 +464,22 @@
};
name = Release;
};
+ 6C40DDA5144CF72800529720 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 6C40DDA6144CF72800529720 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@@ -396,6 +510,14 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
+ 6C40DDA4144CF72800529720 /* Build configuration list for PBXNativeTarget "WaveTest" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 6C40DDA5144CF72800529720 /* Debug */,
+ 6C40DDA6144CF72800529720 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
/* End XCConfigurationList section */
};
rootObject = 6C3B74FA1448737A007125BA /* Project object */;
6 T3nsors/Axisymmetric.cpp
View
@@ -93,3 +93,9 @@ double T3::Axisymmetric::Int(Field x, int p) {
return l2x;
}
+std::ostream& operator<<(std::ostream& out, T3::Axisymmetric x) {
+ for ( T3::Partial& D : x )
+ out << D << "\n";
+ return out;
+}
+
6 T3nsors/Axisymmetric.h
View
@@ -22,10 +22,6 @@ namespace T3 {
};
}
-std::ostream& operator<<(std::ostream& out, T3::Axisymmetric x) {
- for ( T3::Partial& D : x )
- out << D << "\n";
- return out;
-}
+std::ostream& operator<<(std::ostream&, T3::Axisymmetric);
#endif
10 T3nsors/Cartesian.cpp
View
@@ -12,8 +12,8 @@
T3::Cartesian::Cartesian(int d, int n, double x0, double xn, ...) {
Tensor::dim = d;
Tensor::N = Tuple(d);
- Tensor::N[0] = n+1;
- push_back(Partial::Cartesian(0, n+1, x0, xn, this));
+ push_back(Partial::Cartesian(0, n, x0, xn, this));
+ Tensor::N[0] = back().n;
va_list args;
va_start(args, xn);
FRO(i,1,d) {
@@ -56,3 +56,9 @@ double T3::Cartesian::Int(Field x, int p) {
return l2x;
}
+std::ostream& operator<<(std::ostream& out, T3::Cartesian x) {
+ for ( T3::Partial& D : x )
+ out << D << "\n";
+ return out;
+}
+
2  T3nsors/Cartesian.h
View
@@ -24,4 +24,6 @@ namespace T3 {
};
}
+std::ostream& operator<<(std::ostream&, T3::Cartesian);
+
#endif
16 T3nsors/Connection.h
View
@@ -17,18 +17,10 @@
namespace T3 {
class Connection : public Array<Partial> {
public:
- virtual Vector operator()(Scalar) {
- return Vector();
- }
- virtual Scalar operator*(Vector) {
- return Scalar();
- }
- virtual Vector operator&(Vector) {
- return Vector();
- }
- virtual double Int(Field,int) {
- return 0.;
- }
+ virtual Vector operator()(Scalar) = 0;
+ virtual Scalar operator*(Vector) = 0;
+ virtual Vector operator&(Vector) = 0;
+ virtual double Int(Field,int) = 0;
};
}
1  T3nsors/Partial.cpp
View
@@ -65,6 +65,7 @@ T3::Partial T3::Partial::Polar(int p, int n, Object* parent) {
}
double T3::Partial::operator()(int i) {
+ i = mod(i, n);
return a + i*d;
}
16 T3nsors/Set.cpp
View
@@ -0,0 +1,16 @@
+//
+// Set.cpp
+// T3nsors
+//
+// Created by Michael Barriault on 11-10-17.
+// Copyright (c) 2011 University of Guelph. All rights reserved.
+//
+
+#include "Set.h"
+
+T3::Set LC(double a, T3::Set* x, ...) {
+ T3::Set M = (*x) * a;
+ va_list args;
+ va_start(args, x);
+ return _LC<T3::Set>(a, M, args);
+}
31 T3nsors/Set.h
View
@@ -0,0 +1,31 @@
+//
+// Set.h
+// T3nsors
+//
+// Created by Michael Barriault on 11-10-17.
+// Copyright (c) 2011 University of Guelph. All rights reserved.
+//
+
+#ifndef T3nsors_Set_h
+#define T3nsors_Set_h
+
+#include "Tensor.h"
+
+namespace T3 {
+ class Set : public Array<Tensor> {
+ public:
+ Set operator*(const double& a) const {
+ Set other = *this;
+ other.expand(a);
+ return other;
+ }
+ Set& operator+=(const Set& x) {
+ increment(x);
+ return *this;
+ }
+ };
+}
+
+T3::Set LC(double,T3::Set*,...);
+
+#endif
58 T3nsors/Stream.cpp
View
@@ -0,0 +1,58 @@
+//
+// Stream.cpp
+// T3nsors
+//
+// Created by Michael Barriault on 11-10-17.
+// Copyright (c) 2011 University of Guelph. All rights reserved.
+//
+
+#include "Stream.h"
+
+int T3::Stream::nt_min(3);
+int T3::Stream::nt_max(5);
+T3::Partial T3::Stream::t(Partial::Cartesian(0, 10, 0., 1.));
+
+T3::Stream::Stream(T3::Tensor x, std::string id) : id(id) {
+ x.t = 0;
+ push_back(x);
+}
+
+T3::Stream::~Stream() {
+ dump(true);
+ clear();
+}
+
+T3::Stream& T3::Stream::dump(bool all) {
+ unsigned long N = size() < nt_min ? 0 : size()-(1-all)*nt_min;
+ LOOP(N) {
+ // PRINT front() HERE
+ pop_front();
+ }
+ return *this;
+}
+
+T3::Tensor& T3::Stream::operator()(int i) {
+ i = mod(i, (int)size());
+ return at(i);
+}
+
+T3::Tensor T3::Stream::operator()(int i) const {
+ i = mod(i, (int)size());
+ return at(i);
+}
+
+T3::Stream& T3::Stream::operator&=(const T3::Tensor& x) {
+ if ( size() > nt_max ) dump();
+ double t0 = 0.;
+ if ( size() > 0 )
+ t0 = back().t + t.d;
+ push_back(x);
+ back().t = t0;
+ return *this;
+}
+
+T3::Stream& T3::Stream::operator+=(const T3::Tensor& x) {
+ *this &= (back() + x);
+ return *this;
+}
+
34 T3nsors/Stream.h
View
@@ -0,0 +1,34 @@
+//
+// Stream.h
+// T3nsors
+//
+// Created by Michael Barriault on 11-10-17.
+// Copyright (c) 2011 University of Guelph. All rights reserved.
+//
+
+#ifndef T3nsors_Stream_h
+#define T3nsors_Stream_h
+
+#include "Tensor.h"
+#include "Partial.h"
+#include <deque>
+#include <string>
+
+namespace T3 {
+ class Stream : public std::deque<Tensor>, public Object {
+ public:
+ static int nt_min;
+ static int nt_max;
+ static Partial t;
+ std::string id;
+ Stream(Tensor,std::string="");
+ ~Stream();
+ Stream& dump(bool=false);
+ Tensor& operator()(int);
+ Tensor operator()(int) const;
+ Stream& operator+=(const Tensor&);
+ Stream& operator&=(const Tensor&);
+ };
+}
+
+#endif
65 T3nsors/System.cpp
View
@@ -0,0 +1,65 @@
+//
+// System.cpp
+// T3nsors
+//
+// Created by Michael Barriault on 11-10-17.
+// Copyright (c) 2011 University of Guelph. All rights reserved.
+//
+
+#include "System.h"
+
+T3::Partial T3::System::t(Partial::Cartesian(0, 10, 0., 1.));
+
+void T3::System::Evolve() {
+ PreEvolve();
+ Set x1 = *this;
+ Set dx1 = RHS(x1);
+ if ( epsilon > 0 )
+ dx1 += Dissipate(x1) * (-epsilon);
+ Set x2 = LC(1., &x1, 0.5*t.d, &dx1, NULL);
+ Set dx2 = RHS(x2);
+ if ( epsilon > 0 )
+ dx2 += Dissipate(x2) * (-epsilon);
+ Set x3 = LC(1., &x1, 0.75*t.d, &dx2, NULL);
+ Set dx3 = RHS(x3);
+ if ( epsilon > 0 )
+ dx3 += Dissipate(x3) * (-epsilon);
+
+ Set dx = LC(2*t.d/9, &dx1, 3*t.d/9, &dx2, 4*t.d/9, &dx3, NULL);
+ FOR(n,size()) at(n) += dx.at(n);
+}
+
+int T3::System::Run() {
+ Initialize();
+ while ( not Condition() ) Evolve();
+ Cleanup();
+ return Condition();
+}
+
+T3::System::operator Set() {
+ Set s;
+ for ( Stream& S : *this )
+ s.push_back(S.back());
+ return s;
+}
+
+T3::Set T3::System::Dissipate(const Set& U) {
+ Set DU = U;
+ FOR(n, DU.size()) FOR(i, DU.at(n).size()) {
+ const Field& x = U.at(n).at(i);
+ Field& dx = DU.at(n).at(i);
+ FOR(o,dx.size()) dx[o] = 0.;
+ FOR(a, Tensor::dim) {
+ int dg = Tensor::N.Pr(a+1);
+ int dc = Tensor::N.Pr(a);
+ int G = Tensor::N.Pr()/dg;
+ int C = Tensor::N[a];
+ if ( C > 4 ) FOR(g,G) FOR(m,dc) {
+ int i = g*dg + m;
+ FRO(c,2,C-2)
+ dx[i+c*dc] += (x[i+(c-2)*dc]-4*x[i+(c-1)*dc]+6*x[i+c*dc]-4*x[i+(c+1)*dc]+x[i+(c+2)*dc])/16;
+ }
+ }
+ }
+ return DU;
+}
36 T3nsors/System.h
View
@@ -0,0 +1,36 @@
+//
+// System.h
+// T3nsors
+//
+// Created by Michael Barriault on 11-10-17.
+// Copyright (c) 2011 University of Guelph. All rights reserved.
+//
+
+#ifndef T3nsors_System_h
+#define T3nsors_System_h
+
+#include "Stream.h"
+#include "Set.h"
+
+namespace T3 {
+ class System : public Array<Stream> {
+ protected:
+ void Evolve();
+ Set Dissipate(const Set&);
+ public:
+ static Partial t;
+ double epsilon;
+ virtual Set RHS(Set&) = 0;
+ virtual int Condition() = 0;
+ virtual void Initialize() {
+ epsilon = 0.;
+ }
+ virtual void PreEvolve() {}
+ virtual void PostEvolve() {}
+ virtual void Cleanup() {}
+ int Run();
+ operator Set();
+ };
+}
+
+#endif
3  T3nsors/T3nsors.h
View
@@ -20,5 +20,8 @@
#include "Partial.h"
#include "Cartesian.h"
#include "Axisymmetric.h"
+#include "Set.h"
+#include "Stream.h"
+#include "System.h"
#endif
79 WaveTest/WaveTest.1
View
@@ -0,0 +1,79 @@
+.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples.
+.\"See Also:
+.\"man mdoc.samples for a complete listing of options
+.\"man mdoc for the short list of editing options
+.\"/usr/share/misc/mdoc.template
+.Dd 11-10-17 \" DATE
+.Dt WaveTest 1 \" Program name and manual section number
+.Os Darwin
+.Sh NAME \" Section Header - required - don't modify
+.Nm WaveTest,
+.\" The following lines are read in generating the apropos(man -k) database. Use only key
+.\" words here as the database is built based on the words here and in the .ND line.
+.Nm Other_name_for_same_program(),
+.Nm Yet another name for the same program.
+.\" Use .Nm macro to designate other names for the documented program.
+.Nd This line parsed for whatis database.
+.Sh SYNOPSIS \" Section Header - required - don't modify
+.Nm
+.Op Fl abcd \" [-abcd]
+.Op Fl a Ar path \" [-a path]
+.Op Ar file \" [file]
+.Op Ar \" [file ...]
+.Ar arg0 \" Underlined argument - use .Ar anywhere to underline
+arg2 ... \" Arguments
+.Sh DESCRIPTION \" Section Header - required - don't modify
+Use the .Nm macro to refer to your program throughout the man page like such:
+.Nm
+Underlining is accomplished with the .Ar macro like this:
+.Ar underlined text .
+.Pp \" Inserts a space
+A list of items with descriptions:
+.Bl -tag -width -indent \" Begins a tagged list
+.It item a \" Each item preceded by .It macro
+Description of item a
+.It item b
+Description of item b
+.El \" Ends the list
+.Pp
+A list of flags and their descriptions:
+.Bl -tag -width -indent \" Differs from above in tag removed
+.It Fl a \"-a flag as a list item
+Description of -a flag
+.It Fl b
+Description of -b flag
+.El \" Ends the list
+.Pp
+.\" .Sh ENVIRONMENT \" May not be needed
+.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1
+.\" .It Ev ENV_VAR_1
+.\" Description of ENV_VAR_1
+.\" .It Ev ENV_VAR_2
+.\" Description of ENV_VAR_2
+.\" .El
+.Sh FILES \" File used or created by the topic of the man page
+.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact
+.It Pa /usr/share/file_name
+FILE_1 description
+.It Pa /Users/joeuser/Library/really_long_file_name
+FILE_2 description
+.El \" Ends the list
+.\" .Sh DIAGNOSTICS \" May not be needed
+.\" .Bl -diag
+.\" .It Diagnostic Tag
+.\" Diagnostic informtion here.
+.\" .It Diagnostic Tag
+.\" Diagnostic informtion here.
+.\" .El
+.Sh SEE ALSO
+.\" List links in ascending order by section, alphabetically within a section.
+.\" Please do not reference files that do not exist without filing a bug report
+.Xr a 1 ,
+.Xr b 1 ,
+.Xr c 1 ,
+.Xr a 2 ,
+.Xr b 2 ,
+.Xr a 3 ,
+.Xr b 3
+.\" .Sh BUGS \" Document known, unremedied bugs
+.\" .Sh HISTORY \" Document history if command behaves in a unique manner
76 WaveTest/main.cpp
View
@@ -0,0 +1,76 @@
+//
+// main.cpp
+// WaveTest
+//
+// Created by Michael Barriault on 11-10-17.
+// Copyright (c) 2011 University of Guelph. All rights reserved.
+//
+
+#define SLINK \
+Scalar& u = (Scalar&)at(0).back(); \
+Scalar& f = (Scalar&)at(1).back(); \
+Vector& g = (Vector&)at(2).back();
+#define LINK \
+Scalar& u = (Scalar&)x.at(0); \
+Scalar& f = (Scalar&)x.at(1); \
+Vector& g = (Vector&)x.at(2);
+#define DLINK \
+Scalar& du = (Scalar&)dx.at(0); \
+Scalar& df = (Scalar&)dx.at(1); \
+Vector& dg = (Vector&)dx.at(2);
+
+#include <T3nsors/T3nsors.h>
+#include <iostream>
+#include <cmath>
+using namespace T3;
+
+class Wave : public System {
+public:
+ Cartesian Del;
+ Partial& x;
+ Partial& y;
+ Wave(int n, double s, double T) : Del(2, n, -1., 1., -1., 1.) , x(Del[0]) , y(Del[1]) {
+ System::t = Partial(0, 0., s*Del[0].d, T, this);
+ Stream::t = System::t;
+ epsilon = 0.5;
+ push_back(Stream(Scalar(), "u"));
+ push_back(Stream(Scalar()));
+ push_back(Stream(Vector()));
+ }
+
+ void Initialize() { SLINK
+ double w = 2*M_PI / (Del[1].b-Del[0].a);
+
+ FOR(i,Tensor::N[0]) FOR(j,Tensor::N[1]) {
+ u(i,j) = cos(w*x(i));
+ f(i,j) = -w*sin(w*x(i));
+ g(0)(i,j) = w*sin(w*x(i));
+ }
+ }
+
+ Set RHS(Set& x) { LINK
+ Set dx = x; DLINK
+ du = f;
+ df = Del*g;
+ dg = Del(f);
+ std::cout << "Calculating!" << std::endl;
+ return dx;
+ }
+
+ int Condition() {
+ std::cout << "Condition!" << at(0).back().t << t(-1) << std::endl;
+ if ( at(0).back().t > t(-1) )
+ return 1;
+ else
+ return 0;
+ }
+};
+
+int main (int argc, const char * argv[])
+{
+ Wave(10, 0.25, 10.).Run();
+ // insert code here...
+ std::cout << "Hello, World!\n";
+ return 0;
+}
+
Please sign in to comment.
Something went wrong with that request. Please try again.