[MOAB-dev] r2284 - MOAB/trunk

dcthomp at mcs.anl.gov dcthomp at mcs.anl.gov
Tue Nov 25 13:29:43 CST 2008


Author: dcthomp
Date: 2008-11-25 13:29:43 -0600 (Tue, 25 Nov 2008)
New Revision: 2284

Added:
   MOAB/trunk/SweptElementSeq.cpp
   MOAB/trunk/SweptElementSeq.hpp
Log:
ENH: Checkpoint of a skeleton for implementing swept element sequences.
     Not included in the build yet since it does nothing yet.


Added: MOAB/trunk/SweptElementSeq.cpp
===================================================================
--- MOAB/trunk/SweptElementSeq.cpp	                        (rev 0)
+++ MOAB/trunk/SweptElementSeq.cpp	2008-11-25 19:29:43 UTC (rev 2284)
@@ -0,0 +1,102 @@
+/**
+ * MOAB, a Mesh-Oriented datABase, is a software component for creating,
+ * storing and accessing finite element mesh data.
+ * 
+ * Copyright 2008 Sandia Corporation.  Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Coroporation, the U.S. Government
+ * retains certain rights in this software.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ */
+
+#include "SweptElementSeq.hpp"
+#include "ScdVertexData.hpp"
+#include "ScdElementData.hpp"
+#include "MBInterface.hpp"
+#include "MBReadUtilIface.hpp"
+#include "MBCN.hpp"
+#include "MBInternals.hpp"
+
+SweptElementSeq::SweptElementSeq(MBEntityHandle start_handle,
+                                 const int imin, const int jmin, const int kmin,
+				 const int imax, const int jmax, const int kmax,
+                                 const int* Cq ) 
+  : ElementSequence( start_handle, 
+                     ScdElementData::calc_num_entities( start_handle,
+                                                        imax-imin,
+                                                        jmax-jmin,
+                                                        kmax-kmin ),
+                     MBCN::VerticesPerEntity(TYPE_FROM_HANDLE(start_handle)),
+                     new ScdElementData( start_handle, 
+                                        imin, jmin, kmin,
+                                        imax, jmax, kmax ) )
+{
+}
+
+SweptElementSeq::~SweptElementSeq() 
+{
+}
+
+MBErrorCode SweptElementSeq::get_connectivity( 
+                                        MBEntityHandle handle,
+                                        std::vector<MBEntityHandle>& connect,
+                                        bool /*topological*/ ) const
+{
+  int i, j, k;
+  MBErrorCode rval = get_params( handle, i, j, k );
+  if (MB_SUCCESS == rval)
+    rval = get_params_connectivity( i, j, k, connect );
+  return rval;
+}
+
+MBErrorCode SweptElementSeq::get_connectivity( 
+                                        MBEntityHandle handle,
+                                        MBEntityHandle const*& connect,
+                                        int &connect_length,
+                                        bool topo,
+                                        std::vector<MBEntityHandle>* storage
+                                        ) const
+{
+  if (!storage) {
+    connect = 0;
+    connect_length = 0;
+    return MB_NOT_IMPLEMENTED;
+  }
+  
+  storage->clear();
+  MBErrorCode rval = get_connectivity( handle, *storage, topo );
+  connect = &(*storage)[0];
+  connect_length = storage->size();
+  return rval;
+}
+
+MBErrorCode SweptElementSeq::set_connectivity( 
+                                        MBEntityHandle,
+                                        MBEntityHandle const*,
+                                        int )
+{
+  return MB_NOT_IMPLEMENTED;
+}
+
+MBEntityHandle* SweptElementSeq::get_connectivity_array()
+  { return 0; }
+
+int SweptElementSeq::values_per_entity() const
+  { return -1; } // never reuse freed handles for swept elements 
+
+EntitySequence* SweptElementSeq::split( MBEntityHandle here )
+  { return new SweptElementSeq( *this, here ); }
+
+SequenceData* SweptElementSeq::create_data_subset( MBEntityHandle, MBEntityHandle ) const
+  { return 0; }
+
+void SweptElementSeq::get_const_memory_use( unsigned long& bytes_per_entity,
+                                                 unsigned long& sequence_size ) const
+{
+  sequence_size = sizeof(*this);
+//  bytes_per_entity = sdata()->get_memory_use() / sdata()->size();
+}

Added: MOAB/trunk/SweptElementSeq.hpp
===================================================================
--- MOAB/trunk/SweptElementSeq.hpp	                        (rev 0)
+++ MOAB/trunk/SweptElementSeq.hpp	2008-11-25 19:29:43 UTC (rev 2284)
@@ -0,0 +1,93 @@
+/**
+ * MOAB, a Mesh-Oriented datABase, is a software component for creating,
+ * storing and accessing finite element mesh data.
+ * 
+ * Copyright 2008 Sandia Corporation.  Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Coroporation, the U.S. Government
+ * retains certain rights in this software.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ */
+
+#ifndef SWEPT_ELEMENT_SEQUENCE
+#define SWEPT_ELEMENT_SEQUENCE
+
+//
+// Class: SweptElementSequence
+//
+// Purpose: represent a swept element of mesh
+//
+
+#include "ElementSequence.hpp"
+#include "ScdElementData.hpp"
+
+class SweptElementSeq : public ElementSequence
+{
+public:
+
+    //! constructor
+  SweptElementSeq(
+		  MBEntityHandle start_handle,
+		  const int imin, const int jmin, const int kmin,
+		  const int imax, const int jmax, const int kmax,
+		  const int* Cq );
+  
+  virtual ~SweptElementSeq();
+
+    //! given a handle, get the corresponding parameters
+  MBErrorCode get_params(const MBEntityHandle ehandle,
+                          int &i, int &j, int &k) const
+    { }
+  
+    //! get connectivity of an entity given entity's parameters
+  MBErrorCode get_params_connectivity(const int i, const int j, const int k,
+                                std::vector<MBEntityHandle>& connectivity) const
+  { }
+  
+  
+    /***************** Methods from ElementSeq *****************/
+
+  virtual MBErrorCode get_connectivity( MBEntityHandle handle,
+                                        std::vector<MBEntityHandle>& connect,
+                                        bool topological = false ) const;
+  
+  virtual MBErrorCode get_connectivity( MBEntityHandle handle,
+                                        MBEntityHandle const*& connect,
+                                        int &connect_length,
+                                        bool topological = false,
+                                        std::vector<MBEntityHandle>* storage = 0
+                                       ) const;
+
+  virtual MBErrorCode set_connectivity( MBEntityHandle handle,
+                                        MBEntityHandle const* connect,
+                                        int connect_length );
+  
+  virtual MBEntityHandle* get_connectivity_array();
+ 
+   /***************** Methods from EntitySequence *****************/
+
+    /* Replace the ElementSequence implementation of this method with
+     * one that always returns zero, because we cannot re-use handles
+     * that are within a ScdElementData
+     */
+  virtual int values_per_entity() const;
+
+  virtual EntitySequence* split( MBEntityHandle here );
+
+  virtual SequenceData* create_data_subset( MBEntityHandle start_handle,
+                                            MBEntityHandle end_handle ) const;
+
+  virtual void get_const_memory_use( unsigned long& bytes_per_entity,
+                                     unsigned long& size_of_sequence ) const;
+
+protected:
+  SweptElementSeq( SweptElementSeq& split_from, MBEntityHandle here )
+    : ElementSequence( split_from, here )
+    {}
+};
+
+#endif




More information about the moab-dev mailing list