cgma
PartitionEngine.cpp File Reference
#include "PartitionEngine.hpp"
#include "CompositeEngine.hpp"
#include "SubCurve.hpp"
#include "SubSurface.hpp"
#include "SegmentedCurve.hpp"
#include "PartitionPoint.hpp"
#include "PartitionCoEdge.hpp"
#include "PartitionLoop.hpp"
#include "PartitionSurface.hpp"
#include "PartitionLump.hpp"
#include "PartitionBody.hpp"
#include "PartPTCurve.hpp"
#include "PartitionShell.hpp"
#include "BodySM.hpp"
#include "GMem.hpp"
#include "GeometryQueryEngine.hpp"
#include "GeometryModifyEngine.hpp"
#include "GeometryModifyTool.hpp"
#include "VGLoopTool.hpp"
#include "FacetProjectTool.hpp"
#include "CubitFacetData.hpp"
#include "CubitFacetEdgeData.hpp"
#include "CubitPointData.hpp"
#include "TDVGFacetOwner.hpp"
#include "TDVGFacetSplit.hpp"
#include "FacetEvalTool.hpp"
#include "FacetDataUtil.hpp"
#include "PartSurfFacetTool.hpp"
#include "PartitionTool.hpp"
#include "CompositeSurface.hpp"
#include "CompositePoint.hpp"
#include "CompositeCurve.hpp"
#include "PartitionLumpImprint.hpp"
#include "GfxDebug.hpp"
#include "BridgeManager.hpp"
#include "CADefines.hpp"
#include <set>
#include "GeometryQueryTool.hpp"
#include "CubitTransformMatrix.hpp"
#include "CubitObservable.hpp"
#include "AppUtil.hpp"
#include "GeometryEvent.hpp"

Go to the source code of this file.

Functions

static CubitStatus get_edge_replacements (std::vector< CubitFacetData * > &facet_list, std::vector< CubitFacetEdgeData * > replacement_edges[3])
static CubitFacetDatafind_facet (CubitFacetEdge *edge, bool sense, PartitionEntity *owner)
static CubitFacetDatafind_facet (CubitPoint *pt, PartitionEntity *owner)
static CubitFacetDataother_facet (CubitFacetData *facet, int edge, PartitionEntity *owner)

Variables

const char *const PARTITION_GEOM_ATTRIB_NAME = "PARTITION_GEOM"

Function Documentation

static CubitFacetData* find_facet ( CubitFacetEdge edge,
bool  sense,
PartitionEntity owner 
) [static]

Definition at line 1762 of file PartitionEngine.cpp.

{
  DLIList<CubitFacet*> facets(2);
  edge->facets(facets);
  facets.reset();
  for ( int i = facets.size(); i--; ) {
    CubitFacet* facet = facets.get();
    int edge_index = facet->edge_index(edge);
    assert(edge_index >= 0);
    bool forward = edge->point(0) == facet->point((edge_index+1)%3);
    if ( forward != sense || TDVGFacetOwner::get(facet) != owner )
      facets.extract();
    else
      facets.step();
  }
  
  return facets.size() == 1 ? dynamic_cast<CubitFacetData*>(facets.get()) : 0;
}
static CubitFacetData* find_facet ( CubitPoint pt,
PartitionEntity owner 
) [static]

Definition at line 1793 of file PartitionEngine.cpp.

{
  DLIList<CubitFacet*> facets;
  pt->facets(facets);
  facets.reset();
  for ( int i = facets.size(); i--; )
  {
    if ( TDVGFacetOwner::get(facets.get()) == owner )
      facets.step();
    else
      facets.extract();
  }
  
  return facets.size() == 1 ? dynamic_cast<CubitFacetData*>(facets.get()) : 0;
}
static CubitStatus get_edge_replacements ( std::vector< CubitFacetData * > &  facet_list,
std::vector< CubitFacetEdgeData * >  replacement_edges[3] 
) [static]

Definition at line 5875 of file PartitionEngine.cpp.

{
  // first facet is the facet to replace
  // make sure more than one facet to replace the first
  assert(facet_list.size() > 2);

  // make sure the lists of replacement edges are empty
  assert(replace_edge_lists[0].size() == 0);
  assert(replace_edge_lists[1].size() == 0);
  assert(replace_edge_lists[2].size() == 0);


  CubitFacetData* p_dead = facet_list[0]; // facet to be replaced

  // look for edges on the facet that are owned by curves
  int i;
  //int replace_edge = 0;

  // get the edges
  CubitFacetEdgeData *edges[3];
  for (i=0; i<3; i++)
  {
    edges[i] = CAST_TO(p_dead->edge(i), CubitFacetEdgeData);
    assert(edges[i] != NULL);
  }

  PartitionEntity *p_owner;
  PartitionCurve *p_curve;

  // see if any are owned by a curve
  CubitBoolean b_boundary = CUBIT_FALSE;
  for (i=0; i<3 && !b_boundary; i++)
  {
    p_owner = TDVGFacetOwner::get(edges[i]);
    p_curve = CAST_TO(p_owner, PartitionCurve);
    if (p_curve)
      b_boundary = CUBIT_TRUE;
  }

  // if the facet has an edge on a curve, replace the edge with the edges of the
  // replacement facets and split the facet on the adjacent surface.
  if (b_boundary)
  {
    // make a list with just the new facets -- skip the first facet
    DLIList<CubitFacet*> new_facets(facet_list.size() - 1);
    for (unsigned u = 1; u < facet_list.size(); u++)
      new_facets.append(facet_list[u]);

    // get a point edge chain around the boundary of the replacement facets
    DLIList<FacetEntity*> point_edge_chain;
    FacetDataUtil::ordered_point_edge_bdry(new_facets, point_edge_chain);

    // for each edge on a curve get corresponding points and edges from the
    // replacement facets
    //std::vector<CubitFacetEdgeData*>::iterator eitor;
    for (i=0; i<3; i++)
    {
      p_owner = TDVGFacetOwner::get(edges[i]);
      p_curve = CAST_TO(p_owner, PartitionCurve);
      if (p_curve)
      {
        // fill the replacement list for this edge
        // add the edge to be replaced first
        //eitor = replace_edge_lists[i].begin();

        // get the points from the edge of the dead facet - in the correct order
        CubitPoint* pt1;
        CubitPoint* pt2;

        p_dead->get_edge_pts(i, pt1, pt2);

        // get the corresponding chain of points and edges from the replacement facets
        DLIList<FacetEntity*> replacement_chain;
        CubitStatus res = FacetDataUtil::partial_chain(point_edge_chain,
                                         pt1, pt2, replacement_chain);
        if (CUBIT_FAILURE == res)
          return CUBIT_FAILURE;

        // there should be an odd number of list entries, since it includes points
        // and edges, beginning and ending with a point
        assert( (replacement_chain.size() % 2) == 1 );

        // if only one replacement edge, it should be the same edge
        replacement_chain.reset();
        if (replacement_chain.size() == 3)
        {
          assert(replacement_chain.next(1) == edges[i]);
        }
        else
        {
          // add the replacement edges to the list - edge to replace first
          //*eitor++ = edges[i];
          replace_edge_lists[i].push_back(edges[i]);
          int j;
          CubitFacetEdgeData* p_edge;
          for (j=1; j<replacement_chain.size(); j+=2)
          {
            //replacement_chain.step();
            p_edge = CAST_TO(replacement_chain.next(j), CubitFacetEdgeData);
            assert(p_edge != NULL);
            //*eitor++ = p_edge;
            replace_edge_lists[i].push_back(p_edge);
          }
        }
      }
    }
  }

  return CUBIT_SUCCESS;
}
static CubitFacetData* other_facet ( CubitFacetData facet,
int  edge,
PartitionEntity owner 
) [static]

Definition at line 1819 of file PartitionEngine.cpp.

{
  DLIList<CubitFacet*> facets;
  facet->shared_facets( facet->point((edge+1)%3), 
                        facet->point((edge+2)%3),
                        facets );
  for ( int i = facets.size(); i--; )
  {
    CubitFacet* facet = facets.get();
    if( TDVGFacetOwner::get(facet) != owner )
      facets.extract();
    else
      facets.step();
  }
  
  return facets.size() == 1 ? dynamic_cast<CubitFacetData*>(facets.get()) : 0;
}

Variable Documentation

const char* const PARTITION_GEOM_ATTRIB_NAME = "PARTITION_GEOM"

Definition at line 65 of file PartitionEngine.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines