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

Annotation of /branches/more_shared_ptrs_from_1812/finley/src/CPPAdapter/MeshAdapterFactory.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 102 - (hide annotations)
Wed Dec 15 07:08:39 2004 UTC (15 years, 3 months ago) by jgs
Original Path: trunk/esys2/finley/src/CPPAdapter/MeshAdapterFactory.cpp
File size: 5366 byte(s)
*** empty log message ***

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26