/[escript]/trunk/finley/src/CPPAdapter/MeshAdapterFactory.cpp
ViewVC logotype

Contents of /trunk/finley/src/CPPAdapter/MeshAdapterFactory.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 100 - (show annotations)
Wed Dec 15 03:48:48 2004 UTC (14 years, 9 months ago) by jgs
Original Path: trunk/esys2/finley/src/CPPAdapter/MeshAdapterFactory.cpp
File size: 5289 byte(s)
*** empty log message ***

1 /*
2 ******************************************************************************
3 * *
4 * COPYRIGHT ACcESS 2004 - All Rights Reserved *
5 * *
6 * This software is the property of ACcESS. No part of this code *
7 * may be copied in any form or by any means without the expressed written *
8 * consent of ACcESS. Copying, use or modification of this software *
9 * by any unauthorised person is illegal unless that person has a software *
10 * license agreement with ACcESS. *
11 * *
12 ******************************************************************************
13 */
14
15 extern "C" {
16 #include "finley/finleyC/Finley.h"
17 #include "finley/finleyC/Mesh.h"
18 #include "finley/finleyC/RectangularMesh.h"
19 }
20 #include "finley/CPPAdapter/FinleyError.h"
21 #include "finley/CPPAdapter/MeshAdapterFactory.h"
22
23
24
25 #include <iostream>
26 #include <sstream>
27
28 using namespace std;
29 using namespace escript;
30
31 namespace finley {
32
33 AbstractContinuousDomain* readMesh(const std::string& fileName,
34 int integrationOrder)
35 {
36 //
37 // create a copy of the filename to overcome the non-constness of call
38 // to Finley_Mesh_read
39 char fName[fileName.size()+1];
40 strcpy(fName,fileName.c_str());
41 Finley_Mesh* fMesh=Finley_Mesh_read(fName,integrationOrder);
42 checkFinleyError();
43 AbstractContinuousDomain* temp=new MeshAdapter(fMesh);
44 return temp;
45 }
46
47 AbstractContinuousDomain* brick(int n0,int n1,int n2,int order,
48 double l0,double l1,double l2,
49 int periodic0,int periodic1,
50 int periodic2,
51 int integrationOrder,
52 int useElementsOnFace)
53 {
54 // cout << "n0=" << n0 << " n1=" << n1 << " n2=" << n2
55 // << " order=" << order
56 // << " l0=" << l0 << " l1=" << l1 << " l2=" << l2
57 // << " periodic0=" << periodic0
58 // << " periodic1=" << periodic1
59 // << " periodic2=" << periodic2
60 // << " integerationOrder=" << integrationOrder
61 // << " useElementsOnFace=" << useElementsOnFace << endl;
62
63 int numElements[]={n0,n1,n2};
64 double length[]={l0,l1,l2};
65 int periodic[]={periodic0, periodic1, periodic2};
66
67 //
68 // linearInterpolation
69 Finley_Mesh* fMesh;
70 if (order==1) {
71 fMesh=Finley_RectangularMesh_Hex8(numElements,length,periodic,order,
72 useElementsOnFace) ;
73 } else if (order==2) {
74 fMesh=Finley_RectangularMesh_Hex20(numElements,length,periodic,order,
75 useElementsOnFace) ;
76 } else {
77 stringstream temp;
78 temp << "Illegal interpolation order: " << order;
79 setFinleyError(VALUE_ERROR,temp.str().c_str());
80 }
81 //
82 // Convert any finley errors into a C++ exception
83 checkFinleyError();
84 AbstractContinuousDomain* temp=new MeshAdapter(fMesh);
85 return temp;
86 }
87 AbstractContinuousDomain* rectangle(int n0,int n1,int order,
88 double l0, double l1,
89 int periodic0,int periodic1,
90 int integrationOrder,
91 int useElementsOnFace)
92 {
93 int numElements[]={n0,n1};
94 double length[]={l0,l1};
95 int periodic[]={periodic0, periodic1};
96
97 Finley_Mesh* fMesh;
98 if (order==1) {
99 fMesh=Finley_RectangularMesh_Rec4(numElements, length,periodic,order,
100 useElementsOnFace);
101 } else if (order==2) {
102 fMesh=Finley_RectangularMesh_Rec8(numElements,length,periodic,order,
103 useElementsOnFace);
104 } else {
105 stringstream temp;
106 temp << "Illegal interpolation order: " << order;
107 setFinleyError(VALUE_ERROR,temp.str().c_str());
108 }
109 //
110 // Convert any finley errors into a C++ exception
111 checkFinleyError();
112 AbstractContinuousDomain* temp=new MeshAdapter(fMesh);
113 return temp;
114 }
115 AbstractContinuousDomain* interval(int n0,int order,double l0,int periodic0,
116 int integrationOrder,
117 int useElementsOnFace)
118 {
119 int numElements[]={n0};
120 double length[]={l0};
121 int periodic[]={periodic0};
122 Finley_Mesh* fMesh;
123 if (order==1) {
124 fMesh=Finley_RectangularMesh_Line2(numElements, length,periodic,order,
125 useElementsOnFace);
126 } else if (order==2) {
127 fMesh=Finley_RectangularMesh_Line3(numElements,length,periodic,order,
128 useElementsOnFace);
129 } else {
130 stringstream temp;
131 temp << "Illegal interpolation order: " << order;
132 setFinleyError(VALUE_ERROR,temp.str().c_str());
133 }
134 //
135 // Convert any finley errors into a C++ exception
136 checkFinleyError();
137 AbstractContinuousDomain* temp=new MeshAdapter(fMesh);
138 return temp;
139 }
140 AbstractContinuousDomain* meshMerge(const boost::python::list& meshList)
141 {
142 AbstractContinuousDomain* temp=new MeshAdapter(0);
143 return temp;
144 }
145 AbstractContinuousDomain* glueFaces(const boost::python::list& meshList,
146 double safetyFactor,
147 double tolerance)
148 {
149 AbstractContinuousDomain* temp=new MeshAdapter(0);
150 return temp;
151 }
152 AbstractContinuousDomain* joinFaces(const boost::python::list& meshList,
153 double safety_factor,
154 double tolerance)
155 {
156 AbstractContinuousDomain* temp=new MeshAdapter(0);
157 return temp;
158 }
159
160 } // end of namespace

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26