/[escript]/trunk/dataexporter/src/FinleyMesh.cpp
ViewVC logotype

Diff of /trunk/dataexporter/src/FinleyMesh.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2810 by caltinay, Mon Dec 7 04:13:49 2009 UTC revision 2834 by caltinay, Thu Jan 7 06:06:56 2010 UTC
# Line 149  NodeData_ptr FinleyMesh::getMeshForFinle Line 149  NodeData_ptr FinleyMesh::getMeshForFinle
149          return result;          return result;
150    
151      ElementData_ptr elements = getElementsForFinleyFS(functionSpace);      ElementData_ptr elements = getElementsForFinleyFS(functionSpace);
152      if (elements != NULL) {      if (elements != NULL)
153          if (functionSpace == FINLEY_NODES)          result = elements->getNodeMesh();
             result = elements->getNodeMesh();  
         else {  
             if (elements->getReducedNumElements() > 0)  
                 result = elements->getReducedNodeMesh();  
             else  
                 result = elements->getNodeMesh();  
         }  
     }  
154    
155      return result;      return result;
156  }  }
# Line 176  ElementData_ptr FinleyMesh::getElementsF Line 168  ElementData_ptr FinleyMesh::getElementsF
168    
169      switch (functionSpace) {      switch (functionSpace) {
170          case FINLEY_NODES:          case FINLEY_NODES:
171                result = cells;
172                break;
173    
174          case FINLEY_REDUCED_NODES:          case FINLEY_REDUCED_NODES:
175          case FINLEY_REDUCED_ELEMENTS:          case FINLEY_REDUCED_ELEMENTS:
176          case FINLEY_ELEMENTS:          case FINLEY_ELEMENTS:
177              result = cells;              result = cells->getReducedElements();
178                if (!result)
179                    result = cells;
180              break;              break;
181    
182          case FINLEY_REDUCED_FACE_ELEMENTS:          case FINLEY_REDUCED_FACE_ELEMENTS:
183          case FINLEY_FACE_ELEMENTS:          case FINLEY_FACE_ELEMENTS:
184              result = faces;              result = faces->getReducedElements();
185                if (!result)
186                    result = faces;
187              break;              break;
188    
189          case FINLEY_REDUCED_CONTACT_ELEMENTS_1:          case FINLEY_REDUCED_CONTACT_ELEMENTS_1:
190          case FINLEY_REDUCED_CONTACT_ELEMENTS_2:          case FINLEY_REDUCED_CONTACT_ELEMENTS_2:
191          case FINLEY_CONTACT_ELEMENTS_1:          case FINLEY_CONTACT_ELEMENTS_1:
192          case FINLEY_CONTACT_ELEMENTS_2:          case FINLEY_CONTACT_ELEMENTS_2:
193              result = contacts;              result = contacts->getReducedElements();
194                if (!result)
195                    result = contacts;
196              break;              break;
197    
198          default:          default:
# Line 221  StringVec FinleyMesh::getMeshNames() con Line 222  StringVec FinleyMesh::getMeshNames() con
222  }  }
223    
224  //  //
 //  
 //  
 NodeData_ptr FinleyMesh::getMeshByName(const string& name) const  
 {  
     NodeData_ptr ret;  
     if (!initialized) {  
         return ret;  
     }  
     if (name == "Elements")  
         ret = cells->getNodeMesh();  
     else if (name == "ReducedElements")  
         ret = cells->getReducedNodeMesh();  
     else if (name == "FaceElements")  
         ret = faces->getNodeMesh();  
     else if (name == "ReducedFaceElements")  
         ret = faces->getReducedNodeMesh();  
     else if (name == "ContactElements")  
         ret = contacts->getNodeMesh();  
     else if (name == "ReducedContactElements")  
         ret = contacts->getReducedNodeMesh();  
   
     return ret;  
 }  
   
 //  
225  // Returns a vector of strings containing Silo variable names that have  // Returns a vector of strings containing Silo variable names that have
226  // been written  // been written
227  //  //
# Line 274  const IntVec& FinleyMesh::getVarDataByNa Line 250  const IntVec& FinleyMesh::getVarDataByNa
250      if (!initialized) {      if (!initialized) {
251          throw "Mesh not initialized";          throw "Mesh not initialized";
252      }      }
253        
254      if (name.compare(0, 6, "Nodes_") == 0)      if (name.find("ContactElements_") != name.npos)
         return nodes->getVarDataByName(name);  
     else if (name.compare(0, 9, "Elements_") == 0)  
         return cells->getVarDataByName(name);  
     else if (name.compare(0, 13, "FaceElements_") == 0)  
         return faces->getVarDataByName(name);  
     else if (name.compare(0, 16, "ContactElements_") == 0)  
255          return contacts->getVarDataByName(name);          return contacts->getVarDataByName(name);
256        else if (name.find("FaceElements_") != name.npos)
257            return faces->getVarDataByName(name);
258        else if (name.find("Elements_") != name.npos)
259            return cells->getVarDataByName(name);
260        else if (name.find("Nodes_") != name.npos)
261            return nodes->getVarDataByName(name);
262      else      else
263          throw "Invalid variable name";          throw "Invalid variable name";
264  }  }
# Line 293  const IntVec& FinleyMesh::getVarDataByNa Line 269  const IntVec& FinleyMesh::getVarDataByNa
269  ElementData_ptr FinleyMesh::getElementsByName(const string& name) const  ElementData_ptr FinleyMesh::getElementsByName(const string& name) const
270  {  {
271      ElementData_ptr ret;      ElementData_ptr ret;
272      if (name == "Elements" || name == "ReducedElements")      if (name == "Elements")
273          ret = cells;          ret = cells;
274      else if (name == "FaceElements" || name == "ReducedFaceElements")      else if (name == "ReducedElements")
275            ret = cells->getReducedElements();
276        else if (name == "FaceElements")
277          ret = faces;          ret = faces;
278      else if (name == "ContactElements" || name == "ReducedContactElements")      else if (name == "ReducedFaceElements")
279            ret = faces->getReducedElements();
280        else if (name == "ContactElements")
281          ret = contacts;          ret = contacts;
282        else if (name == "ReducedContactElements")
283            ret = contacts->getReducedElements();
284    
285        return ret;
286    }
287    
288    //
289    //
290    //
291    NodeData_ptr FinleyMesh::getMeshByName(const string& name) const
292    {
293        NodeData_ptr ret;
294        if (initialized) {
295            ElementData_ptr els = getElementsByName(name);
296            if (els)
297                ret = els->getNodeMesh();
298        }
299    
300      return ret;      return ret;
301  }  }
# Line 314  void FinleyMesh::reorderGhostZones(int o Line 311  void FinleyMesh::reorderGhostZones(int o
311          contacts->reorderGhostZones(ownIndex);          contacts->reorderGhostZones(ownIndex);
312  #ifdef _DEBUG  #ifdef _DEBUG
313          cout << "block " << ownIndex << " has " << cells->getGhostCount()          cout << "block " << ownIndex << " has " << cells->getGhostCount()
314               << " (reduced=" << cells->getReducedGhostCount()               << " ghost zones," << endl;
315               << ") ghost zones," << endl;          cout << "\t" << faces->getGhostCount() << " ghost faces," << endl;
316          cout << "\t" << faces->getGhostCount() << " ("          cout << "\t" << contacts->getGhostCount() << " ghost contacts." << endl;
              << faces->getReducedGhostCount() << ") ghost faces," << endl;  
         cout << "\t" << contacts->getGhostCount() << " ("  
              << contacts->getReducedGhostCount() << ") ghost contacts." << endl;  
317  #endif  #endif
318      }      }
319  }  }

Legend:
Removed from v.2810  
changed lines
  Added in v.2834

  ViewVC Help
Powered by ViewVC 1.1.26