Version 12.00:

Added functionality to fit a function to set of sample values (PointInterpolant)
Added functionality to sample a function at prescribed locations (AdaptiveTreeVisualization)
This commit is contained in:
mkazhdan
2019-07-19 00:25:18 -04:00
parent 5ca45fbd82
commit 9230936ab4
19 changed files with 1391 additions and 93 deletions
+23 -4
View File
@@ -358,7 +358,7 @@ void ExtractMesh( UIntPack< FEMSigs ... > , std::tuple< SampleData ... > , FEMTr
typename IsoSurfaceExtractor< Dim , Real , Vertex >::IsoStats isoStats;
if( sampleData )
{
SparseNodeData< ProjectiveData< TotalPointSampleData , Real > , IsotropicUIntPack< Dim , DataSig > > _sampleData = tree.template setDataField< DataSig , false >( *samples , *sampleData , (DensityEstimator*)NULL );
SparseNodeData< ProjectiveData< TotalPointSampleData , Real > , IsotropicUIntPack< Dim , DataSig > > _sampleData = tree.template setMultiDepthDataField< DataSig , false >( *samples , *sampleData , (DensityEstimator*)NULL );
for( const RegularTreeNode< Dim , FEMTreeNodeData , depth_and_offset_type >* n = tree.tree().nextNode() ; n ; n=tree.tree().nextNode( n ) )
{
ProjectiveData< TotalPointSampleData , Real >* clr = _sampleData( n );
@@ -603,8 +603,27 @@ void Execute( int argc , char* argv[] , UIntPack< FEMSigs ... > )
{
profiler.start();
normalInfo = new SparseNodeData< Point< Real , Dim > , NormalSigs >();
if( ConfidenceBias.value>0 ) *normalInfo = tree.setNormalField( NormalSigs() , *samples , *sampleData , density , pointWeightSum , [&]( Real conf ){ return (Real)( log( conf ) * ConfidenceBias.value / log( 1<<(Dim-1) ) ); } );
else *normalInfo = tree.setNormalField( NormalSigs() , *samples , *sampleData , density , pointWeightSum );
std::function< bool ( TotalPointSampleData , Point< Real , Dim >& ) > ConversionFunction = []( TotalPointSampleData in , Point< Real , Dim > &out )
{
Point< Real , Dim > n = in.template data<0>();
Real l = (Real)Length( n );
// It is possible that the samples have non-zero normals but there are two co-located samples with negative normals...
if( !l ) return false;
out = n / l;
return true;
};
std::function< bool ( TotalPointSampleData , Point< Real , Dim >& , Real & ) > ConversionAndBiasFunction = []( TotalPointSampleData in , Point< Real , Dim > &out , Real &bias )
{
Point< Real , Dim > n = in.template data<0>();
Real l = (Real)Length( n );
// It is possible that the samples have non-zero normals but there are two co-located samples with negative normals...
if( !l ) return false;
out = n / l;
bias = (Real)( log( l ) * ConfidenceBias.value / log( 1<<(Dim-1) ) );
return true;
};
if( ConfidenceBias.value>0 ) *normalInfo = tree.setDataField( NormalSigs() , *samples , *sampleData , density , pointWeightSum , ConversionAndBiasFunction );
else *normalInfo = tree.setDataField( NormalSigs() , *samples , *sampleData , density , pointWeightSum , ConversionFunction );
profiler.dumpOutput2( comments , "# Got normal field:" );
messageWriter( "Point weight / Estimated Area: %g / %g\n" , pointWeightSum , pointCount*pointWeightSum );
}
@@ -674,7 +693,7 @@ void Execute( int argc , char* argv[] , UIntPack< FEMSigs ... > )
if( !fp ) ERROR_OUT( "Failed to open file for writing: " , Tree.value );
FEMTree< Dim , Real >::WriteParameter( fp );
DenseNodeData< Real , Sigs >::WriteSignatures( fp );
tree.write( fp );
tree.write( fp , xForm );
solution.write( fp );
fclose( fp );
}