Memosa-FVM  0.2
pFVM.cpp File Reference
#include <string>
#include <vector>
#include "MMReader.h"
#include "AMG.h"
#include "Array.h"
#include "PartMesh.h"
#include "FluentReader.h"
#include "Mesh.h"
#include "NcDataWriter.h"
#include "NcDataReader.h"
Include dependency graph for pFVM.cpp:

Go to the source code of this file.

Functions

void debug_mesh (MeshList mesh_list)
 
int main (int argc, char *argv[])
 

Function Documentation

void debug_mesh ( MeshList  mesh_list)

Definition at line 92 of file pFVM.cpp.

References Mesh::getBoundaryFaceGroups(), Mesh::getBoundaryGroupCount(), Mesh::getCellNodes(), Mesh::getCells(), CRConnectivity::getCol(), CRConnectivity::getColDim(), StorageSite::getCount(), Mesh::getDimension(), Mesh::getFaceGroupCount(), Mesh::getFaces(), Mesh::getID(), Mesh::getInterfaceGroupCount(), Mesh::getInteriorFaceGroup(), CRConnectivity::getLocalizedSubset(), Mesh::getNodes(), StorageSite::getOffset(), CRConnectivity::getRow(), CRConnectivity::getRowDim(), StorageSite::getSelfCount(), CRConnectivity::getSubset(), FaceGroup::groupType, FaceGroup::id, and FaceGroup::site.

93 {
94 //understand Mesh
95  Mesh* mesh = mesh_list.at(0);
96 
97  cout << " mesh dimension = " << mesh->getDimension() << endl;
98  cout << " mesh ID = " << mesh->getID() << endl;
99 
100  StorageSite& faces = mesh->getFaces();
101  StorageSite& cells = mesh->getCells();
102  StorageSite& nodes = mesh->getNodes();
103 
104  cout << " Faces " << endl;
105  cout << " StorageSite::getCount() = " << faces.getCount() << endl;
106  cout << " StorageSite::getSelfCount() = " << faces.getSelfCount() << endl;
107  cout << " StorageSite::getOffset() = " << faces.getOffset() << endl;
108 
109  cout << " Cells " << endl;
110  cout << " StorageSite::getCount() = " << cells.getCount() << endl;
111  cout << " StorageSite::getSelfCount() = " << cells.getSelfCount() << endl;
112  cout << " StorageSite::getOffset() = " << cells.getOffset() << endl;
113 
114  cout << " Nodes " << endl;
115  cout << " StorageSite::getCount() = " << nodes.getCount() << endl;
116  cout << " StorageSite::getSelfCount() = " << nodes.getSelfCount() << endl;
117  cout << " StorageSite::getOffset() = " << nodes.getOffset() << endl;
118 
119 {
120  const CRConnectivity& cellNodes= mesh->getCellNodes();
121  //const CRConnectivity& cellNodes= mesh->getCellCells();
122  //const CRConnectivity& cellNodes = mesh->getCellFaces();
123  //const CRConnectivity& cellNodes = mesh->getAllFaceNodes();
124  const Array<int>& rowCellNodes = cellNodes.getRow();
125  const Array<int>& colCellNodes = cellNodes.getCol();
126 
127 
128  cout << " CRConnectivity::getCellNodes() " << endl;
129  cout << " ::getRowDim() = " << cellNodes.getRowDim() << endl;
130  cout << " ::getColDim() = " << cellNodes.getColDim() << endl;
131  for ( int cell = 0; cell < cellNodes.getRowDim(); cell++){
132  cout << " row[" << cell+1 <<"] = " << rowCellNodes[cell] << " ";
133  int nnodes = rowCellNodes[cell+1] - rowCellNodes[cell];
134  for ( int node = 0; node < nnodes; node++){
135  cout << colCellNodes[ rowCellNodes[cell] + node ]+1 << " ";
136  }
137  cout << endl;
138  }
139 }
140  cout << " " << endl;
141  cout << " Mesh::getFaceGroupCount() = " << mesh->getFaceGroupCount() << endl;
142  cout << " Mesh::getBoundaryGroupCount() = " << mesh->getBoundaryGroupCount() << endl;
143  cout << " Mesh::getInterfaceGroupCount()= " << mesh->getInterfaceGroupCount() << endl;
144  cout << endl;
145 
146  const FaceGroup& interiorFaceGroup = mesh->getInteriorFaceGroup();
147  cout << " interiorFaceGroup id = " << interiorFaceGroup.id << endl;
148  cout << " interiorFaceGroup groupType = " << interiorFaceGroup.groupType << endl;
149  cout << " site.getCount() = " << interiorFaceGroup.site.getCount() << endl;
150  cout << endl;
151 
152  const FaceGroupList& bounFaceGroup = mesh->getBoundaryFaceGroups();
153 
154 
155 
156  for ( int i = 0; i < int(bounFaceGroup.size()); i++){
157  cout << " bounFaceGroup id = " << bounFaceGroup.at(i)->id << endl;
158  cout << " bounFaceGroup groupType = " << bounFaceGroup.at(i)->groupType << endl;
159  cout << " site.getCount() = " << bounFaceGroup.at(i)->site.getCount() << endl;
160  cout << endl;
161  }
162 
163 
164 {
165  //use of CRConnectivity::getSubset
166  const CRConnectivity& cellNodes= mesh->getCellNodes();
167  StorageSite site( 3, 2);
168  Array<int> indices(5);
169  indices[0] = 35; indices[1] = 3; indices[2] = 2; indices[3] = 16; indices[4] = 29;
170  shared_ptr<CRConnectivity> subCellNodes = cellNodes.getSubset( site, indices);
171  const Array<int>& rowCellNodes = subCellNodes->getRow();
172  const Array<int>& colCellNodes = subCellNodes->getCol();
173 
174  cout << " subCellNodes = " << endl;
175  cout << " getRowDim() = " << subCellNodes->getRowDim() << endl;
176  cout << " getColDim() = " << subCellNodes->getColDim() << endl;
177  for ( int cell = 0; cell < subCellNodes->getRowDim(); cell++){
178  cout << " row[" << cell+1 <<"] = " << rowCellNodes[cell] << " ";
179  int nnodes = rowCellNodes[cell+1] - rowCellNodes[cell];
180  for ( int node = 0; node < nnodes; node++){
181  cout << colCellNodes[ rowCellNodes[cell] + node ]+1 << " ";
182  }
183  cout << endl;
184  }
185 
186  cout << endl;
187 }
188 
189 //use of CRConnectivity::getLocalizedSubset(..)
190 {
191  const CRConnectivity& cellNodes= mesh->getCellNodes();
192  StorageSite rowsite( 3, 2);
193  StorageSite colsite(13);
194  Array<int> indices(5);
195  indices[0] = 35; indices[1] = 3; indices[2] = 2; indices[3] = 16; indices[4] = 29;
196  shared_ptr<CRConnectivity> subLocalCellNodes = cellNodes.getLocalizedSubset( rowsite, colsite, indices);
197  const Array<int>& rowCellNodes = subLocalCellNodes->getRow();
198  const Array<int>& colCellNodes = subLocalCellNodes->getCol();
199 
200  cout << " subCellNodes = " << endl;
201  cout << " getRowDim() = " << subLocalCellNodes->getRowDim() << endl;
202  cout << " getColDim() = " << subLocalCellNodes->getColDim() << endl;
203  for ( int cell = 0; cell < subLocalCellNodes->getRowDim(); cell++){
204  cout << " row[" << cell+1 <<"] = " << rowCellNodes[cell] << " ";
205  int nnodes = rowCellNodes[cell+1] - rowCellNodes[cell];
206  for ( int node = 0; node < nnodes; node++){
207  cout << colCellNodes[ rowCellNodes[cell] + node ]+1 << " ";
208  }
209  cout << endl;
210  }
211 
212  cout << endl;
213 
214 }
215 
216 
217 
218 
219 
220 
221 }
const FaceGroupList & getBoundaryFaceGroups() const
Definition: Mesh.h:187
const Array< int > & getCol() const
const Array< int > & getRow() const
const FaceGroup & getInteriorFaceGroup() const
Definition: Mesh.h:181
int getBoundaryGroupCount() const
Definition: Mesh.h:184
shared_ptr< CRConnectivity > getSubset(const StorageSite &site, const Array< int > &indices) const
int getSelfCount() const
Definition: StorageSite.h:40
Definition: Mesh.h:28
const StorageSite & getNodes() const
Definition: Mesh.h:110
int getFaceGroupCount() const
Definition: Mesh.h:183
Definition: Mesh.h:49
int getInterfaceGroupCount() const
Definition: Mesh.h:185
string groupType
Definition: Mesh.h:42
const int id
Definition: Mesh.h:41
shared_ptr< CRConnectivity > getLocalizedSubset(const StorageSite &newRowSite, StorageSite &newColSite, const Array< int > &indices) const
vector< FaceGroupPtr > FaceGroupList
Definition: Mesh.h:47
const StorageSite & getFaces() const
Definition: Mesh.h:108
const StorageSite & getCells() const
Definition: Mesh.h:109
int getOffset() const
Definition: StorageSite.h:87
int getCount() const
Definition: StorageSite.h:39
int getDimension() const
Definition: Mesh.h:105
int getRowDim() const
int getID() const
Definition: Mesh.h:106
const CRConnectivity & getCellNodes() const
Definition: Mesh.cpp:426
int getColDim() const
StorageSite site
Definition: Mesh.h:40
int main ( int  argc,
char *  argv[] 
)

Definition at line 24 of file pFVM.cpp.

References FluentReader::getMeshList(), and FluentReader::readMesh().

25 {
26 /* MMReader reader(argv[1], argv[2]);
27 
28  shared_ptr<LinearSystem> ls(reader.getLS());
29 
30  AMG solver;
31  solver.solve(*ls); */
32 
33 
34  MPI::Init(argc, argv);
35 
36  //PartMesh* partMesh = new PartMesh( MPI::COMM_WORLD.Get_rank() );
37 
38 
39  string file_name( argv[1] );
40  FluentReader* fluent_reader = new FluentReader( file_name );
41  cout << " arg 1= " << argv[1] << endl;
42  fluent_reader->readMesh();
43 
44  MeshList mesh_list = fluent_reader->getMeshList();
45 
46  //debug_mesh( mesh_list );
47 
48 
49  //mesh_list
50  vector<int> npart( mesh_list.size(), MPI::COMM_WORLD.Get_size() );
51  vector<int> etype( mesh_list.size(), 1);
52 
53  //constructer to PartMesh
54  PartMesh* part_mesh = new PartMesh(mesh_list, npart, etype );
55 
56  //set properties of Partition
57  part_mesh->setWeightType(0);
58  part_mesh->setNumFlag(0);
59 
60  //actions
61 // part_mesh->fiedler_order("permutation26.txt");
62 
63  part_mesh->partition();
64 
65  part_mesh->mesh();
66 
67  delete fluent_reader;
68 
69 // stringstream ss;
70 // ss << "test_" << MPI::COMM_WORLD.Get_rank() << ".cdf";
71 // NcDataWriter nc_writer( part_mesh.meshList(), ss.str() );
72 // nc_writer.record();
73 //
74 // NcDataReader nc_reader( ss.str() );
75 // stringstream ss_test;
76 // ss_test << "test_test_" << MPI::COMM_WORLD.Get_rank() << ".cdf";
77 // MeshList meshes = nc_reader.getMeshList();
78 //
79 // NcDataWriter nc_writer_test( meshes, ss_test.str() );
80 // nc_writer_test.record();
81 // NcDataReader::destroyMeshList( meshes );
82 
83  delete part_mesh;
84  MPI::Finalize();
85 
86 }
MeshList getMeshList()
vector< Mesh * > MeshList
Definition: Mesh.h:439