⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 meshgenerator.cpp

📁 模糊聚類分析源碼。包含教學文件
💻 CPP
字号:
/*    Context       : Fuzzy Clustering Algorithms  Author        : Frank Hoeppner, see also AUTHORS file   Description   : implementation of class module MeshGenerator                    History       :      Comment       :     This file was generated automatically. DO NOT EDIT.  Copyright     : Copyright (C) 1999-2000 Frank Hoeppner    This program is free software; you can redistribute it and/or modify    it under the terms of the GNU General Public License as published by    the Free Software Foundation; either version 2 of the License, or    (at your option) any later version.    This program is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU General Public License for more details.    You should have received a copy of the GNU General Public License    along with this program; if not, write to the Free Software    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*//*  The University of Applied Sciences Oldenburg/Ostfriesland/Wilhelmshaven  hereby disclaims all copyright interests in the program package `fc'   (tool package for fuzzy cluster analysis) written by Frank Hoeppner.    Prof. Haass, President of Vice, 2000-Mar-10*/#ifndef MeshGenerator_SOURCE#define MeshGenerator_SOURCE/* configuration include */#ifdef HAVE_CONFIG_H/*//FILETREE_IFDEF HAVE_CONFIG_H*/#include "config.h"/*//FILETREE_ENDIF*/#endif// necessary includes#include "MeshGenerator.hpp"#include "Box.hpp"#include "Selector.hpp"// data#define INCLUDE_FEATURE(f) \  for (axis=0;axis<DIM;++axis) \    { \    point[axis] = a_analysis.select(a_analysis.option().m_selector[axis], \      (f),0,0,0,i_link); \    } \  select_bbox.include( point );// implementationtemplate < class ANALYSIS >MeshGenerator< ANALYSIS >::MeshGenerator  (  Algorithm<ANALYSIS>* ap_alg  )  : mp_succ_alg(ap_alg)  , mp_stat_alg(stat(new NoOperation<ANALYSIS>()))    {    }template < class ANALYSIS >MeshGenerator< ANALYSIS >::~MeshGenerator  (  )  {  FUNCLOG("~MeshGenerator");  delete mp_stat_alg;  delete mp_succ_alg;  }template < class ANALYSIS >voidMeshGenerator< ANALYSIS >::operator()  (  ANALYSIS& a_analysis  )  {  FUNCLOG("MeshGenerator");    const int DIM(3); // AXIS_X, AXIS_Y, AXIS_Z  int axis;  const TData overlap_percent(    (a_analysis.option().m_constants[0]==-1)       ? 5       : a_analysis.option().m_constants[0] );  if (a_analysis.option().bbox().rows()==0) (*mp_stat_alg)(a_analysis);  bbox_type data_bbox(a_analysis.option().bbox());  data_bbox.adjust(a_analysis.option().data_dimension());  bbox_type select_bbox;  typename ANALYSIS::data_type feature;  {    typename ANALYSIS::link_iter i_link(a_analysis.links().begin());    tuple_type point;    for (        typename ANALYSIS::data_iter i_data(a_analysis.data().begin());        i_data != a_analysis.data().end();        ++i_data        )      {      INCLUDE_FEATURE(*i_data);      for (int i=0;i<a_analysis.option().number_prototypes();++i) ++i_link;      }    invariant(i_link==a_analysis.links().end(),"links match",SOURCELOC);    feature = (*a_analysis.data().begin());    i_link = a_analysis.links().begin();    feature.datum() = data_bbox.lowerBound;    INCLUDE_FEATURE(feature);    feature.datum() = data_bbox.upperBound;    INCLUDE_FEATURE(feature);    trace("data bbox:",data_bbox);    trace("select bbox:",select_bbox);  }    data_bbox.enlarge_percent(overlap_percent);  select_bbox.enlarge_percent(overlap_percent);  int mesh_dimension(0);  TData mesh_volume(1);  TData mesh_resolution[DIM] = {1,1,1};  for (axis=0;axis<DIM;++axis)    {    if (!equal((TData)0,select_bbox.length(axis)))      {      mesh_resolution[axis] = select_bbox.length(axis);      mesh_volume *= select_bbox.length(axis);      ++mesh_dimension;      }    }  trace("mesh dimension is",mesh_dimension);  trace("mesh volume is",mesh_volume);  if (a_analysis.option().inter_data_distance()==-1)    {    a_analysis.option().inter_data_distance() =       pow(mesh_volume/(a_analysis.option().maximum_features()-1),1.0/mesh_dimension);    trace("choose inter data distance",a_analysis.option().inter_data_distance());    }  for (axis=0;axis<mesh_dimension;++axis)    {     mesh_resolution[axis] /= a_analysis.option().inter_data_distance();    ++mesh_resolution[axis];    if (mesh_resolution[axis] < 1) mesh_resolution[axis]=1.0;    trace("set mesh_resolution[axis]",mesh_resolution[axis]);    }  feature.datum().adjust(a_analysis.option().data_dimension());  for (axis=0;axis<feature.datum().rows();++axis)    {    feature.datum()[axis] = data_bbox.mean(axis);    }  if (a_analysis.option().substitute_features())     {    a_analysis.data().clear();    feature.weight() = DEFAULT_FEATURE_WEIGHT;    }  else    {    feature.weight() = 0;    }  for (int x=0;x<(int)mesh_resolution[AXIS_X];++x)    {    feature.define(a_analysis.option().m_selector[AXIS_X],      select_bbox.minimum(AXIS_X) + a_analysis.option().inter_data_distance()*x);    for (int y=0;y<(int)mesh_resolution[AXIS_Y];++y)      {      feature.define(a_analysis.option().m_selector[AXIS_Y],        select_bbox.minimum(AXIS_Y) + a_analysis.option().inter_data_distance()*y);      for (int z=0;z<(int)mesh_resolution[AXIS_Z];++z)        {        feature.define(a_analysis.option().m_selector[AXIS_Z],          select_bbox.minimum(AXIS_Z) + a_analysis.option().inter_data_distance()*z);        a_analysis.data().insert(a_analysis.data().end(),feature);        trace("inserted mesh point",feature);        }      }    }  a_analysis.option().number_features() = a_analysis.data().size();  a_analysis.links().clear();  (*mp_succ_alg)(a_analysis);    }// template instantiation#endif // MeshGenerator_SOURCE

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -