Back to index

salome-smesh  6.5.0
Public Member Functions
StdMeshers::StdMeshers_CartesianParameters3D Interface Reference

interface of "Body fitting Parameters" hypothesis. More...

import "SMESH_BasicHypothesis.idl";

Inheritance diagram for StdMeshers::StdMeshers_CartesianParameters3D:
Inheritance graph
[legend]
Collaboration diagram for StdMeshers::StdMeshers_CartesianParameters3D:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void SetSizeThreshold (in double threshold) raises (SALOME::SALOME_Exception)
 Set size threshold.
double GetSizeThreshold ()
boolean IsGridBySpacing (in short axis)
 Return true if the grid is defined by spacing functions and not by node coordinates in given direction (X==0,...)
void SetGrid (in SMESH::double_array coords, in short axis) raises (SALOME::SALOME_Exception)
 Set coordinates of nodes along an axis (counterd from zero)
SMESH::double_array GetGrid (in short axis) raises (SALOME::SALOME_Exception)
void SetGridSpacing (in SMESH::string_array spaceFunctions, in SMESH::double_array internalPoints, in short axis) raises (SALOME::SALOME_Exception)
 Set grid spacing along an axis.
void GetGridSpacing (out SMESH::string_array spaceFunctions, out SMESH::double_array internalPoints, in short axis) raises (SALOME::SALOME_Exception)
SMESH::double_array ComputeCoordinates (in double x0, in double x1, in SMESH::string_array spaceFuns, in SMESH::double_array points, in string axisName) raises (SALOME::SALOME_Exception)
 Computes node coordinates by spacing functions.
string GetName ()
 Get the Hypothesis typeName.
string GetLibName ()
 Get the Hypothesis plugin library Name.
long GetId ()
 Get the internal Id.
void SetVarParameter (in string parameter, in string method)
 Set the variable parameter.
string GetVarParameter (in string methodName)
 Return the variable parameter used for Hypothesis creation by name of method setting this parameter.
void SetParameters (in string theParameters)
 Set list of parameters.
string GetParameters ()
 Return list of notebook variables used for Hypothesis creation separated by ":" symbol.
ListOfParameters GetLastParameters ()
 Return list of last notebook variables used for Hypothesis creation.
void SetLastParameters (in string theParameters)
 Set list of parameters.
void ClearParameters ()
 Clear parameters list.
boolean IsDimSupported (in Dimension type)
 Verify whether hypothesis supports given entity type.

Detailed Description

interface of "Body fitting Parameters" hypothesis.

This hypothesis specifies

Definition at line 870 of file SMESH_BasicHypothesis.idl.


Member Function Documentation

void SMESH_Hypothesis::ClearParameters ( ) [inherited]

Clear parameters list.

Definition at line 196 of file SMESH_Hypothesis.cxx.

{
  _parameters = string();
}
void StdMeshers_CartesianParameters3D::ComputeCoordinates ( in double  x0,
in double  x1,
in SMESH::string_array  spaceFuns,
in SMESH::double_array  points,
in string  axisName 
) raises (SALOME::SALOME_Exception)

Computes node coordinates by spacing functions.

Parameters:
x0- lower coordinate
x1- upper coordinate
spaceFuns- space functions
points- internal points
coords- the computed coordinates

Definition at line 218 of file StdMeshers_CartesianParameters3D.cxx.

{
  checkGridSpacing( spaceFuns, points, axis );

  coords.clear();
  for ( size_t i = 0; i < spaceFuns.size(); ++i )
  {
    FunctionExpr fun( spaceFuns[i].c_str(), /*convMode=*/-1 );

    const double p0 = x0 * ( 1. - points[i])   + x1 * points[i];
    const double p1 = x0 * ( 1. - points[i+1]) + x1 * points[i+1];
    const double length = p1 - p0;

    const size_t nbSections = 1000;
    const double sectionLen = ( p1 - p0 ) / nbSections;
    vector< double > nbSegments( nbSections + 1 );
    nbSegments[ 0 ] = 0.;

    double t, spacing = 0;
    for ( size_t i = 1; i <= nbSections; ++i )
    {
      t = double( i ) / nbSections;
      if ( !fun.value( t, spacing ) || spacing < std::numeric_limits<double>::min() )
        throw SALOME_Exception(LOCALIZED("Invalid spacing function"));
      nbSegments[ i ] = nbSegments[ i-1 ] + std::min( 1., sectionLen / spacing );
    }

    const int nbCells = max (1, int(floor(nbSegments.back()+0.5)));
    const double corr = nbCells / nbSegments.back();

    if ( coords.empty() ) coords.push_back( p0 );

    for ( size_t iCell = 1, i = 1; i <= nbSections; ++i )
    {
      if ( nbSegments[i]*corr >= iCell )
      {
        t = (i - ( nbSegments[i] - iCell/corr )/( nbSegments[i] - nbSegments[i-1] )) / nbSections;
        coords.push_back( p0 + t * length );
        ++iCell;
      }
    }
    const double lastCellLen = coords.back() - coords[ coords.size() - 2 ];
    if ( fabs( coords.back() - p1 ) > 0.5 * lastCellLen )
      coords.push_back ( p1 );
  }
}
void StdMeshers_CartesianParameters3D::GetGrid ( in short  axis) raises (SALOME::SALOME_Exception)

Definition at line 316 of file StdMeshers_CartesianParameters3D.cxx.

{
  if ( IsGridBySpacing(axis) )
    throw SALOME_Exception(LOCALIZED("The grid is defined by spacing and not by coordinates"));

  coords = _coords[axis];
}
void StdMeshers_CartesianParameters3D::GetGridSpacing ( out SMESH::string_array  spaceFunctions,
out SMESH::double_array  internalPoints,
in short  axis 
) raises (SALOME::SALOME_Exception)

Definition at line 189 of file StdMeshers_CartesianParameters3D.cxx.

{
  if ( !IsGridBySpacing(axis) )
    throw SALOME_Exception(LOCALIZED("The grid is defined by coordinates and not by spacing"));

  spaceFunctions = _spaceFunctions[axis];
  internalPoints = _internalPoints[axis];
}
long SMESH::SMESH_Hypothesis::GetId ( ) [inherited]

Get the internal Id.

char * SMESH_Hypothesis::GetLastParameters ( ) [inherited]

Return list of last notebook variables used for Hypothesis creation.

Definition at line 216 of file SMESH_Hypothesis.cxx.

{
  return (char*)_lastParameters.c_str();
}
const char * SMESH_Hypothesis::GetLibName ( ) [inherited]

Get the Hypothesis plugin library Name.

Definition at line 141 of file SMESH_Hypothesis.cxx.

{
  return _libName.c_str();
}
string SMESH::SMESH_Hypothesis::GetName ( ) [inherited]

Get the Hypothesis typeName.

Here is the caller graph for this function:

char * SMESH_Hypothesis::GetParameters ( ) [inherited]

Return list of notebook variables used for Hypothesis creation separated by ":" symbol.

Definition at line 206 of file SMESH_Hypothesis.cxx.

{
  return (char*)_parameters.c_str();
}

Definition at line 330 of file StdMeshers_CartesianParameters3D.cxx.

{
  return _sizeThreshold;
}
string SMESH::SMESH_Hypothesis::GetVarParameter ( in string  methodName) [inherited]

Return the variable parameter used for Hypothesis creation by name of method setting this parameter.

boolean SMESH::SMESH_Hypothesis::IsDimSupported ( in Dimension  type) [inherited]

Verify whether hypothesis supports given entity type.

Return true if the grid is defined by spacing functions and not by node coordinates in given direction (X==0,...)

Definition at line 205 of file StdMeshers_CartesianParameters3D.cxx.

{
  checkAxis(axis);
  return !_spaceFunctions[axis].empty();
}
void StdMeshers_CartesianParameters3D::SetGrid ( in SMESH::double_array  coords,
in short  axis 
) raises (SALOME::SALOME_Exception)

Set coordinates of nodes along an axis (counterd from zero)

Definition at line 120 of file StdMeshers_CartesianParameters3D.cxx.

{
  checkAxis( axis );

  if ( coords.size() < 2 )
    throw SALOME_Exception(LOCALIZED("Wrong number of grid coordinates"));

  std::sort( coords.begin(), coords.end() );

  bool changed = ( _coords[axis] != coords );
  if ( changed )
  {
    _coords[axis] = coords;
    NotifySubMeshesHypothesisModification();
  }

  _spaceFunctions[axis].clear();
  _internalPoints[axis].clear();
}
void StdMeshers_CartesianParameters3D::SetGridSpacing ( in SMESH::string_array  spaceFunctions,
in SMESH::double_array  internalPoints,
in short  axis 
) raises (SALOME::SALOME_Exception)

Set grid spacing along an axis.

Parameters:
spaceFunctions- functions defining spacing values at given point on axis
internalPoints- points dividing a grid into parts along an axis
axis- index of an axis counterd from zero, i.e. 0==X, 1==Y, 2==Z

Parameter t of spaceFunction f(t) is a position [0,1] withing bounding box of the shape to mesh or withing an interval defined by internal points

Definition at line 146 of file StdMeshers_CartesianParameters3D.cxx.

{
  checkAxis( axis );

  checkGridSpacing( xSpaceFuns, xInternalPoints, axisName[axis] );

  bool changed = ( xSpaceFuns      != _spaceFunctions[axis] ||
                   xInternalPoints != _internalPoints[axis] );

  _spaceFunctions[axis] = xSpaceFuns;
  _internalPoints[axis] = xInternalPoints;
  _coords[axis].clear();

  if ( changed )
    NotifySubMeshesHypothesisModification();
}
void SMESH_Hypothesis::SetLastParameters ( in string  theParameters) [inherited]

Set list of parameters.

Parameters:
theParametersis a string containing the last notebook variables separated by ":" symbol, used for Hypothesis creation

Definition at line 226 of file SMESH_Hypothesis.cxx.

{
  _lastParameters = string(theParameters);
}
void SMESH_Hypothesis::SetParameters ( in string  theParameters) [inherited]

Set list of parameters.

Parameters:
theParametersis a string containing the notebook variables separated by ":" symbol, used for Hypothesis creation

Definition at line 180 of file SMESH_Hypothesis.cxx.

{
  string aNewParameters(theParameters);
  if(aNewParameters.size()==0 && _parameters.size()==0)
    aNewParameters = " ";
  if(_parameters.size()>0)
    _parameters +="|";
  _parameters +=aNewParameters;
  SetLastParameters(theParameters);
}

Here is the call graph for this function:

void StdMeshers_CartesianParameters3D::SetSizeThreshold ( in double  threshold) raises (SALOME::SALOME_Exception)

Set size threshold.

A polyhedral cell got by cutting an initial hexahedron by geometry boundary is considered small and is removed if it's size is times less than the size of the initial hexahedron. threshold must be > 1.0

Definition at line 171 of file StdMeshers_CartesianParameters3D.cxx.

{
  if ( threshold <= 1.0 )
    throw SALOME_Exception(LOCALIZED("threshold must be > 1.0"));

  bool changed = fabs( _sizeThreshold - threshold ) > 1e-6;
  _sizeThreshold = threshold;

  if ( changed )
    NotifySubMeshesHypothesisModification();
}
void SMESH::SMESH_Hypothesis::SetVarParameter ( in string  parameter,
in string  method 
) [inherited]

Set the variable parameter.

Parameters:
parameteris a string containing the notebook variable used for Hypothesis creation
methodis a name of Hypothesis method setting this parameter

This method must be called before calling method()


The documentation for this interface was generated from the following files: